def getGrade(mark):
#If marks between 90 to 100:grade'O'
if mark>=90 and mark<=100:
return "O"
#marks between 80 to 90:grade'A+'
if mark>=80 and mark<90:
return "A+"
#marks between 70 to 80:grade'A'
if mark>=70 and mark<80:
return "A"
#marks between 60 to 70:grade'B+'
if mark>=60 and mark<70:
return "B+"
#marks between 50 to 60:grade'B'
return "B"
studentNames={}
studentMarks={}
N = int(input("Enter number of students: "))
for i in range(N):
print("Enter Details of student No.", i+1)
registrationNumber = int(input("Enter the registration number of the student: "))
name = input("Enter the name of the student: ")
mark = int(input("Enter the mark of the student: "))
studentNames[registrationNumber] = name
grade=getGrade(mark)
studentMarks[registrationNumber] = [mark,grade]
print(studentNames)
print(studentMarks)
Comments
Leave a comment