brilliant_moves

YahooAnswersPythonGame.py

Nov 18th, 2014
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. import random
  2. lives = 3
  3. score = 0
  4.  
  5. while lives>0:
  6.     weapon = int(input("Choose your weapon (0,1,2): "))
  7.     r = random.randrange(100)
  8.     if weapon==0: # Twig
  9.         if r<10: # 10% chance to win
  10.             print( "The rabbit was defeated!")
  11.             score += 1000
  12.             score = print("Your score is now", score)
  13.         else:
  14.             print( "You have died a slow and miserable death!" )
  15.             lives -= 1
  16.             print( "You now have", lives, "lives left")
  17.  
  18.     elif weapon==1: # Sharpened Stick
  19.         if r<20: # 20% chance to win
  20.             print( "Right through the heart!")
  21.             score += 900
  22.             print("Your score is now", score)
  23.         else:
  24.             print( "Did you really think a stick would work?" )
  25.             lives -= 1
  26.             print( "You have", lives, "lives remaining")
  27.  
  28.     elif weapon==2: # Rock
  29.         if r<30: # 30% chance to win
  30.             print( "You sure rocked that rabbit!")
  31.             score += 800
  32.             print("Your score is now", score)
  33.         else:
  34.             print( "The rabbit seems to be immune to rocks!" )
  35.             lives -= 1
  36.             print( "You have", lives, "lives remaining")
Add Comment
Please, Sign In to add comment