daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. import math
  3.  
  4. class Hitmynoumber(object):
  5.  
  6.     def randomi(self):
  7.         r = math.floor((random.random() * 10) +1)
  8.         return r
  9.  
  10.     def guess(self):
  11.         playing = True
  12.  
  13.         while playing:
  14.  
  15.             userip = input("Your noumber: ")
  16.  
  17.             if (int(userip) == gamec.randomi()):
  18.                 print("Cumputer: " + str(gamec.randomi()))
  19.                 print("Win :)nPlay again? Yes[y]/No[n] : ")
  20.                 stopplay= input()
  21.                 if (stopplay == 'n' or stopplay == 'N'):
  22.                     playing=False
  23.  
  24.             else:
  25.                 print("Cumputer: " + str(gamec.randomi()))
  26.                 print("Lose :(nPlay again? Yes[y]/No[n] : ")
  27.                 stopplay = input()
  28.                 if (stopplay == 'n' or stopplay == 'N'):
  29.                     playing=False
  30.  
  31.         print("Thanks 4 plaing :D")
  32.  
  33.  
  34.  
  35. if __name__ == "__main__":
  36.     gamec = Hitmynoumber()
  37.     print("Can you hit my noumber of 1-10? :D?nGood Luck! :Dn")
  38.     gamec.guess()
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