Advertisement
elena_gancedo

Pass number

Aug 5th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. # Challenge 3
  2. import random
  3. def number_code(game):
  4.     if game == "yes":
  5.         n1 = random.randint(0,9)
  6.         n2 = random.randint(0,9)
  7.         n3 = random.randint(0,9)
  8.         n4 = random.randint(0,9)
  9.         n5 = random.randint(0,9)
  10.         n6 = random.randint(0,9)
  11.         print("Your pass code is : " + str(n1) + str(n2) + str(n3) + str(n4) + str(n5) + str(n6))
  12.     return
  13. # loop  
  14. finished = False
  15. while finished == False:
  16.     game = input("Do you want to select a pass code?: yes/no: ")
  17.     if game == "yes":
  18.         number_code(game)
  19.     else:
  20.         print("Your answer has been... " + game + " , bye.")
  21.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement