S.no. Topic Date Pg. no.
Remarks
PYTHON PROGRAM
▪ Working With Functions
# PROGRAM 1: -
@ To find sum of two numbers.
def sum(x,y):
s=x+y
print(s)
return(s)
x=int(input("Enter Number 1:"))
y=int(input("Enter Number 2:"))
sum(x,y)
# PROGRAM 2: -
@ To write table of any two numbers.
def table():
a=int(input("Enter No:"))
for i in range(1,11):
b=a*i
print(a,"X",i,"=",b)
table()
n=int(input("Enter No:"))
f=1
for i in range(1,n+1):
f=i*f
print(f)
fact()
# PROGRAM 5: -
@ To calculate simple interest.
def Loop_SI(x,y,z):
s=(x*y*z)/100
print("Simple interest =",s)
ch="yes"
while ch=="yes":
a=int(input("Enter Amount:"))
b=int(input("Enter Rate:"))
c=int(input("Enter Time:"))
Loop_SI(a,b,c)
ch=input("Do you want to continue? (yes/no):")
if ch=="no":
break
▪ File Handling
# PROGRAM 1: -
@ to calculate number of lines in a text file .
def calc_lines():
f=open("diary.txt","r")
b=f.readlines()
c=len(b)
print(c)
f.close
calc_lines()
# PROGRAM 2: -
@ to enter multiple records in binary file.
import pickle
def write():
f=open("bin.dat","wb")
record=[]
while True:
roll=int(input("Enter Roll:"))