Python program for generating marksheet with random names and marks
#baccho ki marksheet
n=int(input("Enter How many students marksheet u want :"))
print("=====================================================================")
print(" Name | Sci Mar | Math Mar | SS Mar | Max Mar | Status | Aver ")
while n!=0:
flag=0
from random import *
names=["Karan","Raj","Ram","Mohan","Arjun","Sachin","Aakash","Ramesh"]
name=choice(names)
mathm=randint(30,100)
sciem=randint(30,100)
ssm=randint(30,100)
avg=round((ssm+sciem+mathm)/3,2)
if mathm<35:
flag+=1
elif sciem<35:
flag+=1
elif ssm<35:
flag+=1
if flag>0:
status="Fail."
else:
status="Pass."
if mathm>sciem and mathm>ssm:
max=mathm
elif mathm>sciem and ssm>mathm:
max=ssm
elif sciem>mathm and sciem>ssm:
max=sciem
elif sciem>mathm and ssm>sciem:
max=ssm
print("%-8s"%name,"|","%7d"%sciem,"|","%7d"%mathm,"|","%7d"%ssm,"|","%7d"%max,"| ",status,"|","%7.2f"%avg)
n-=1
Comments
Post a Comment