Skip to main content

Project in python


Source code


lslno=[]
lname=[]
leng=[]
lhnd=[]
lmth=[]
lsci=[]
lsst=[]
ltot=[]
lper=[]
lgrad=[]
val=1


def calculategrade():
 str="y"
 while str=="y":
  slno=int(input("Enter the Sl. No.: "))
  lslno.append(slno)
  name=input("Enter the Name: ")
  lname.append(name)
  print("Please enter the marks of the subjects")
  eng=int(input("English: "))
  leng.append(eng)
  hnd=int(input("Hindi: "))
  lhnd.append(hnd)
  mth=int(input("Maths: "))
  lmth.append(mth)
  sci=int(input("Science: "))
  lsci.append(sci)
  sst=int(input("Sst: "))
  lsst.append(sst)
  total=eng+hnd+mth+sci+sst
  ltot.append(total)
  per=(total/500)*100
  lper.append(per)
  if per>=60:
   lgrad.append("A")
  elif per>=45 and per<60:
   lgrad.append("B")
  elif per>=30 and per<45:
   lgrad.append("C")
  else:
   lgrad.append("Fail")
  str=input("Do you want to continue entering records (y/n): ")
 
def specifyrec():
 recno=int(input("Enter serial no to print the record: "))
 print("Sl. No.\t","Name\t","Hnd\t","Eng\t","Mth\t","Sci\t","Sst\t","Total\t","Percent","Grade")
 print(lslno[recno-1],"\t",lname[recno-1],"\t",leng[recno-1],"\t",lhnd[recno-1],"\t",lmth[recno-1],"\t",lsci[recno-1],"\t",lsst[recno-1],"\t",ltot[recno-1],"\t",lper[recno-1],"\t",lgrad[recno-1])
def allrecord():
 num=len(lslno)
 print("Sl. No.\t","Name\t","Hnd\t","Eng\t","Mth\t","Sci\t","Sst\t","Total\t","Percent","Grade")
 for item in range(0,num):
  print(lslno[item],"\t",lname[item],"\t",leng[item],"\t",lhnd[item],"\t",lmth[item],"\t",lsci[item],"\t",lsst[item],"\t",ltot[item],"\t",lper[item],"\t",lgrad[item])

print("Enter your Choice")
print("1. Add student to list")
print("2. Show all the list")
print("3. Show specific data")
print("4. Exit")
val=int(input())
while val!=4:
 if val==1:
  calculategrade()
 elif val==2:
  allrecord()
 elif val==3:
  specifyrec()
 print("Enter your Choice")
 print("1. Add student to list")
 print("2. Show all the list")
 print("3. Show specific data")
 print("4. Exit")
 val=int(input())

Comments