Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 0.66 KB | Hits: 32 | Expires: Never
Copy text to clipboard
  1. #generates a random number from 1 to 100
  2. import random
  3. secret = random.randint(1,100)
  4. tries = 0
  5. z = 0
  6.  
  7. print("Hi! You have 5 tries to guess a number between 1 and a hundred.")
  8. a = 0
  9. while tries < 5 and secret != a:
  10.     a = input("Whats your guess?")
  11.     if  a < secret:
  12.         print("Too low! Try again!")
  13.         tries += 1
  14.     elif a > secret:
  15.               print("Too high! Try again!")
  16.               tries += 1
  17.     while tries == 5:
  18.         print("too many tries!")
  19.         tries + 1
  20.     while tries == 6:
  21.         print("you lose")
  22.        
  23.        
  24.    
  25.  
  26. if secret == a:
  27.     print("winner!")
  28.  
  29. else:
  30.               print ("YOU LOSE!!")