Page 58 -
P. 58

starting to code


                          Pool Puzzle


                          Your task is to take the Python code
                              fragments from the pool and place
                              them into the blank lines in the
                               game. You may not use the same
                               code fragment more than once, and
                               you won’t need to use all the code
                               fragments. Your goal is to complete
                             the guessing game program.
                          Hint: Don’t forget to indent.


                            print("Welcome!")
                            g = input("Guess the number: ")
                            guess = int(g)





















           Note: each code
           fragment from the
           pool can be used only
           once!                            print("Too high")


                                  print("You lose!")   print("Game over!")

                                                             if guess == 5:     if guess > 5:
                                                   else:
                       print("You win!")    else:                             else:
                                                  print("Too low")
                                                                               if guess <= 5:






                                                                                        you are here 4    23
   53   54   55   56   57   58   59   60   61   62   63