Programming Example

Can you store the detail of 10 students in a dictionary at the same time? details include – rollno, name ,marks ,grade etc. Give example to support your answer.

Solution

dic = { }
while True  :
    roll = input("enter the roll no. of student (enter Q for quit )= ")
    if roll == "Q" or roll == "q" :
        break
    else :
        name = input("enter the name of student  = ")
        mark = input("enter the marks of student = ")
        grade = input("enter the grade of stucent = ")
        dic[roll] = [ name , mark , grade ]
print(dic)
Output

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad