Page 388 - Computer Science Class 11 With Functions
P. 388

Objective: To display menu
                  Input Parameters: None
                  Return Value: None
                  '''
                  print("MAIN MENU")
                  print("1. Accept Data")
                  print("2. Display Data")
                  print("3. Display Points")
                  print("4. Exit")

                  choice = int(input("Enter your choice:  "))

                  if choice == 1:
                      accept()
                  elif choice == 2:
                      display()
                  elif choice == 3:
                      points()
                  else:
                      return

              def display():
                  '''
                  Objective: To display data of schools
                  Input Parameters: None
                  Return Value: None
                  '''
                  for school in pointsTally:
                      print(school, pointsTally[school])

                  menu()


              def points():
                  '''
                  Objective: To calculate and display points
                  Input Parameters: None
                  Return Value: None
                  '''

                  school = input("Enter School Name :  ")
                  if school in pointsTally.keys():
                      print("Congratulations!! You have scored  ", pointsTally[school][2], "points")
                  else:
                      print("Sorry .. Your school is not registered")


         386   Touchpad Computer Science-XI
   383   384   385   386   387   388   389   390   391   392   393