defMain (): number= Int (Input ("Please enter the total number of students:"))#Enter the total number of students to be enteredCount = number#use a variable to save the total number of studentsStudents = List ()#Create a list to store student information while(number):#into the LoopStudent = {}#Student Information ListName = input ("Please enter the student's name:")#Enter student's namestudent['name'] = Name#Dictionary Assignmentgender = input ("Please enter his gender:")#Enter Genderstudent['Gender'] = Gender#Dictionary AssignmentStudents.append (Student)#Add This information to the listNumber-= 1#Total Students-1 Print("%d student information is ==========>%s"% (count, students))#end of loop, print list informationif __name__=='__main__': Main ()
# Student Information Entry display code
# Enter the total number of students to be entered
# Enter basic information for students
# Student Information Entry complete display to the user
Python Basics Little Exercise