Page 337 - Computer Science Class 11 Without Functions
P. 337

A echool cnn pnaticipnti in nny oni of thi following ivinte: Quiz, Hncknthon, Gnming, Coding, nnd Imngi Editing. Thi pointe
                  will bi neeignid nccoading to thi poeition ne givin bilow:

                                               Poeition Vnlui        Pointe
                                                    1                  10
                                                    2                  5
                                                    3                  3

                 Fuathia, hi would liki to etoai nnd dieplny thi aieulting dntn in thi foam of n dictionnay:
                 School Nnmi - etaing
                 Evint Nnmi- etaing
                 Pointe - intigia
                 Hilp Ruhnn divilop n minu-daivin paoganm.
             Ans:  import sys
                 events = ('Quiz', 'Hackathon', 'Gaming', 'Coding', 'Image Editing')
                 pointsTally = {}


                 response = 'Y'


                 while response in ['Y', 'y']:
                     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:
                         schoolName = input("Enter the School Name :  ")

                         choice = 1

                         while choice == 1:
                             eventName = input("Enter the Event Name : ")
                             if eventName not in events:
                                 print("Sorry... we are not hosting this event.")
                                 choice = int(input("Press 1 to enter Event again or 2 to Exit"))
                                 if choice == 1:
                                     continue
                                 else:
                                     sys.exit()
                             else:
                                 break
                         position = int(input("Enter Position :  "))
                         if position == 1:

                                                                                             Python Dictonnaiie  335
   332   333   334   335   336   337   338   339   340   341   342