python lab9
python lab9
NO: 9
71762305009 MODULES AND PACKAGES
19.03.2025
AIM:
PROGRAM:
CODE:
OUTPUT:
CODE:
import math as m
import random as r
import datetime
y = datetime.datetime.now()
x=int(input("enter a number:"))
print(f"Factorial: {m.factorial(x)}")
print(f"Square root:{m.sqrt(x)}")
print(f"Natural logirithm:{m.log(x)}")
print("")
print(f"The random number generated between 0 and 100 is
{r.randrange(1,100,4)}")
print("")
print(f"Current date and time:{y}")
OUTPUT:
90-100: A
80-89 : B
70-79 : C
60-69 : D
< 60 : F
Write a script (main.py) that:
o Imports the package.
o Accepts a student's name, ID, and marks.
o Uses calculate_grade() to determine the grade.
o Displays the student’s information and grade.
CODE:
elif a1==2:
x1=int(input("enter account no:"))
y2=0
while(y2==0):
print("1.deposit \n 2.withdraw \n 3.Enquire Balance\n 4.exit")
y=int(input("enter choice:"))
if y==1:
t.deposit(x1)
elif y==2:
t.withdraw(x1)
elif y==3:
t.balance(x1)
elif y==4:
y2=1
elif a1==3:
x=0
OUTPUT:
RESULT:
The python programs using modules and packages have been implemented and
verified sucessfully.