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 is a number from 1 to 99. I'll give you 6 tries. ")
while guess != secret and tries < 6:
    guess = input ("What's yer guess? ")
    if guess < secret:
        print ("Too low, ye scurvy dog")
    elif guess > secret:
        print ("Too high, landrubber!")
    tries = tries + 1
if guess == secret:
    print ("Avast! Ye got it! Found my secret, ye did!")
else:
    print ("No more guesses! Better luck next time, matey!")
    print ("The secret number was", secret)
I keep getting this error: if guess < secret: TypeError: unorderable types: str() < int()
guess = input ("What's yer guess? ")
Calling input gives you back a string, not an int.  When you then compare guess using <, you need an int in order to compare a numerical value.  Try doing something along the lines of:
try:
    guess = int(input("What's yer guess? "))
except ValueError:
    # Handle bad input
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With