LAB 11 Pfund
LAB 11 Pfund
LAB 11 Pfund
SECTION E
LAB # 11
MODULES AND PACKAGES
OBJECTIVE:
Getting familiar with the environment for using modules and packages.
A. Point out the errors, if any, and paste the output also in the following Python programs.
1. Code:
import sys as s
print(sys.executable)
print(sys.getwindowsversion())
ERROR:
CORRECT CODE:
OUTPUT:
USAMA MEHBOOB ROLL NO 2022F-SE-225
SECTION E
2. CODE:
ERROR:
In line 3 there is no module name times.
CORRECT CODE:
OUTPUT:
USAMA MEHBOOB ROLL NO 2022F-SE-225
SECTION E
3. CODE:
From math import math
# using square root(sqrt) function contained
print(Math.sqrt(25))
print(Math.pi)
# 2 radians = 114.59 degrees
print(Math.degrees(2))
ERROR:
Remove from math from line 1
Write small m in math in all print lines
CORRECT CODE:
OUTPUT:
USAMA MEHBOOB ROLL NO 2022F-SE-225
SECTION E
B. What would be the output of the following programs:
1. CODE:
OUTPUT:
2. CODE:
OUTPUT:
USAMA MEHBOOB ROLL NO 2022F-SE-225
SECTION E
3. CODE:
OUTPUT:
USAMA MEHBOOB ROLL NO 2022F-SE-225
SECTION E
OUTPUT:
2. Write a NumPy program to create a 3x3 matrix with values ranging from 2 to 10.
CODE:
OUTPUT: