# this is a guess number game.
import random

guessesTaken = 0

print('hello! What is your name?')
myName = input()

number = random.randint(1, 20)
print('Well, ' + myName + ', i am thinking of a number between 1 and 20')

while guessesTaken < 6:
    print('take a guess.')
    guess = input()
    guess_value = int(guess)

    guessesTaken = guessesTaken + 1

    print("type(guess_value)=",type(guess_value))
    print("type(number)=",type(number))

    if guess_value < number:
        print('your guess is too low.')

    if guess_value > number:
        print('your guess is too high.')

    if guess_value == number:
        break

    if guess_value == number:
       guessesTaken = str(guessesTaken)
       print ('good job, ' + myName + '! you guessed my number in ' +
guessesTaken + ' guesses!')

    if guess_value != number:
        number = str(number)
        print ('nope. the number i was thinking of was ' + number)

# this is a guess number game.
import random

guessesTaken = 0

print('hello! What is your name?')
myName = input()

number = random.randint(1, 20)
print('Well, ' + myName + ', i am thinking of a number between 1 and 20')

while guessesTaken < 6:
    print('take a guess.')
    guess = input()
    guess_value = int(guess)

    guessesTaken = guessesTaken + 1

    print("type(guess_value)=",type(guess_value))
    print("type(number)=",type(number))

    if guess_value < number:
        print('your guess is too low.')

    if guess_value > number:
        print('your guess is too high.')

    if guess_value == number:
        break

    if guess_value == number:
       guessesTaken = str(guessesTaken)
       print ('good job, ' + myName + '! you guessed my number in ' +
guessesTaken + ' guesses!')

    if guess_value != number:
        number = str(number)
        print ('nope. the number i was thinking of was ' + number)

# this is a guess number game.
import random

guessesTaken = 0

print('hello! What is your name?')
myName = input()

number = random.randint(1, 20)
print('Well, ' + myName + ', i am thinking of a number between 1 and 20')

while guessesTaken < 6:
    print('take a guess.')
    guess = input()
    guess_value = int(guess)

    guessesTaken = guessesTaken + 1

    print("type(guess_value)=",type(guess_value))
    print("type(number)=",type(number))

    if guess_value < number:
        print('your guess is too low.')

    if guess_value > number:
        print('your guess is too high.')

    if guess_value == number:
        break

    if guess_value == number:
       guessesTaken = str(guessesTaken)
       print ('good job, ' + myName + '! you guessed my number in ' +
guessesTaken + ' guesses!')

    if guess_value != number:
        number = str(number)
        print ('nope. the number i was thinking of was ' + number)

# this is a guess number game.
import random

guessesTaken = 0

print('hello! What is your name?')
myName = input()

number = random.randint(1, 20)
print('Well, ' + myName + ', i am thinking of a number between 1 and 20')

while guessesTaken < 6:
    print('take a guess.')
    guess = input()
    guess_value = int(guess)

    guessesTaken = guessesTaken + 1

    print("type(guess_value)=",type(guess_value))
    print("type(number)=",type(number))

    if guess_value < number:
        print('your guess is too low.')

    if guess_value > number:
        print('your guess is too high.')

    if guess_value == number:
        break

    if guess_value == number:
       guessesTaken = str(guessesTaken)
       print ('good job, ' + myName + '! you guessed my number in ' +
guessesTaken + ' guesses!')

    if guess_value != number:
        number = str(number)
        print ('nope. the number i was thinking of was ' + number)

# this is a guess number game.
import random

guessesTaken = 0

print('hello! What is your name?')
myName = input()

number = random.randint(1, 20)
print('Well, ' + myName + ', i am thinking of a number between 1 and 20')

while guessesTaken < 6:
    print('take a guess.')
    guess = input()
    guess_value = int(guess)

    guessesTaken = guessesTaken + 1

    print("type(guess_value)=",type(guess_value))
    print("type(number)=",type(number))

    if guess_value < number:
        print('your guess is too low.')

    if guess_value > number:
        print('your guess is too high.')

    if guess_value == number:
        break

    if guess_value == number:
       guessesTaken = str(guessesTaken)
       print ('good job, ' + myName + '! you guessed my number in ' +
guessesTaken + ' guesses!')

    if guess_value != number:
        number = str(number)
        print ('nope. the number i was thinking of was ' + number)

=================================================================================================
dont understand the error TypeError unorderable types 'int()' <' str()'
run the code from cmd prompt also error
inserted a print function before the first "if" statement
which return type (guess_value) = <class int>
type(number) = <class int>
================================================================================================
run the next line and  prints
type(guess_value) = int
type(number)=str


================================================================================================
from the cmd: the error is TypeError not supported between instance of
'int'  and 'str'

How do do i fix this ??, i typed it right from a tutorial
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to