Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import math
- class Hitmynoumber(object):
- def randomi(self):
- r = math.floor((random.random() * 10) +1)
- return r
- def guess(self):
- playing = True
- while playing:
- userip = input("Your noumber: ")
- if (int(userip) == gamec.randomi()):
- print("Cumputer: " + str(gamec.randomi()))
- print("Win :)nPlay again? Yes[y]/No[n] : ")
- stopplay= input()
- if (stopplay == 'n' or stopplay == 'N'):
- playing=False
- else:
- print("Cumputer: " + str(gamec.randomi()))
- print("Lose :(nPlay again? Yes[y]/No[n] : ")
- stopplay = input()
- if (stopplay == 'n' or stopplay == 'N'):
- playing=False
- print("Thanks 4 plaing :D")
- if __name__ == "__main__":
- gamec = Hitmynoumber()
- print("Can you hit my noumber of 1-10? :D?nGood Luck! :Dn")
- gamec.guess()
Add Comment
Please, Sign In to add comment