asked 158k views
3 votes
why is this not working out? I'm confused I thought that because it was a "guess.isdigit()" it would only continue if i was a number??

why is this not working out? I'm confused I thought that because it was a "guess-example-1
why is this not working out? I'm confused I thought that because it was a "guess-example-1
why is this not working out? I'm confused I thought that because it was a "guess-example-2

2 Answers

7 votes

Answer:

Because guess is not converted to int

Step-by-step explanation:

try adding line "guess = int(guess)" between lines "if guess.isdigit():" and "print("That's Correct!")"

answered
User Aelkz
by
7.8k points
5 votes

This is because input() returns data of type string. Arithmetic operations cannot be performed between different types. Just replace the first line with this and your problem will be solved.

  • guess = int(input("Guess a number between 1 and 10: "))
answered
User Gabrielhpugliese
by
7.9k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.