import random
secret = random.randint(1, 99)
guess = 0
tries = 0
print("AHOY! I'm the Dread Pirate Roberts, and I have a secret")
print("It's the number from 1 to 99..and I'll give you 6 chances")
while guess != secret and tries < 6:
guess = input("What's your guess? ")
if guess < secret:
print("To Low...You creep")
elif guess > secret:
print("Too High, Douchbag")
tries = tries + 1
if guess == secret:
print("Avast! You finally got it!")
else:
print("No more chances...Play again later")
print("The secret number was", secret)
'<' not supported between instances of 'str' and 'int'
|
'<' not supported between instances of 'str' and 'int'
|
|
Apr-09-2019, 03:25 PM
input returns string and therefore you comparing string with int which for quite obvious reasons is not possible. You should convert input to int.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame. |
|
|
Users browsing this thread: 1 Guest(s)
