Hi, and welcome to the tutor list.

Please try to provide a useful subject line in future posts (not "help", perhaps something like "I don't understand this TypeError message").

Anyway, to your question:

On 03Aug2017 13:27, Howard Lawrence <1019sh...@gmail.com> wrote:
hi ! i am newbie to coding love it but need help with problems which i
searched but poor results this is the error: typeError unorderable types:
int()<str()

Please always include the entire error message with a text cut/paste; it usually contains lots of useful information.

The error above means that you have a "int" and a "str", and are trying to compare them. That is not supported.

the code in short

Please always incode the full code, ideally something stripped down to the smallest program you can run which still produces the error. Often problems come from something which is omitted in a "from memory" description of the code, rather than the raw code itself.

number=random.randint(1,20)
guess=input()
guess=int(guess)
but when reach the line that says
if guess<number:

i get the error ! help

As remarked, you can't compare an int and a str; it is not meaningful.

Your code above _should_ have an int in the value of "guess". However, I suspect your code actually may look like this:

 number=random.randint(1,20)
 guess=input()
 guess_value=int(guess)
 if guess<number:

and theat you should have "guess_value" in the "if" condition, not "guess".

i.e. I'm suggesting that you haven't put the int into "guess" but into some other variable.

Cheers,
Cameron Simpson <c...@cskk.id.au> (formerly c...@zip.com.au)
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to