Page 262 -
P. 262

building a graphical user interface











                    Prompt the host.
                                    `choice = input(prompt)

                    While the game   while choice != ‘0':
                    hasn't ended....      if choice == ‘1':

                If the answer is
                correct, increment the           number_asked = number_asked + 1
                counters and then play
                the appropriate sound.          number_correct = number_correct + 1
                                            wait_finish(correct_s.play())
            If the answer is
             incorrect, increment       if choice == ‘2':
             the counters and play
             the sound effect.              number_asked = number_asked + 1
                                            number_wrong = number_wrong + 1

                                            wait_finish(wrong_s.play())

                                        choice = input(prompt)



                                     print(“You asked " + str(number_asked) + “ questions.")

                                     print(str(number_correct) + “ were correctly answered.")

                                     print(str(number_wrong) + “ were answered incorrectly.")
          At the end of the program,
           display a summary of the
           counter values.
















                                                                                       you are here 4    227
   257   258   259   260   261   262   263   264   265   266   267