SHARE
TWEET

Untitled

a guest Sep 17th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. from time import sleep
  3.  
  4. def new_game():
  5.  
  6.   answer = input("Play a round? Y/N").upper()
  7.   if answer == "Y":
  8.     game_roll(0,0)
  9.   elif answer == "N":
  10.     print("Goodbye.")
  11.     exit()
  12.   else:
  13.     new_game(0,0)
  14.     print("Invalid entry")
  15.  
  16. def game_roll(wins, losses):
  17.  
  18.   while wins != 3 and losses != 3:
  19.  
  20.     print("If I roll 55 or below, you win.  Good luck!")
  21.     print("Rolling!...")
  22.     number = random.randint(1, 100)
  23.     print(number)
  24.  
  25.     if number >= 56:
  26.  
  27.       print("That sucks! 1 point to the host.")
  28.       losses = losses + 1
  29.       print("You have " + str(wins) + " wins and " + str(losses) + " losses")
  30.       print("Re-rolling...")
  31.       game_roll(wins, losses)
  32.  
  33.     else:
  34.  
  35.       print("you won this round!")
  36.       wins = wins + 1
  37.       print("You have " + str(wins) + " wins and " + str(losses) + " losses")
  38.       print("Re-rolling...")
  39.       game_roll(wins, losses)
  40.  
  41.   print("Game is over")
  42.  
  43.   if wins >= 3:
  44.  
  45.     print("You won this round of dice! You have won " + str(wins) +" rounds! with " + str(losses) + " losses")
  46.     new_game()
  47.  
  48.   else:
  49.  
  50.     print("You lost! You had " + str(wins) + " wins " + "and " + str(losses) + " losses")
  51.     new_game()
  52.  
  53.  
  54. if __name__ == '__main__':
  55.  
  56.   new_game()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top