I seem to have a problem i dont know how to fix with my program
[deleted]
It seems to be with the last 3 lines but there's no spelling errors or anything.
Its going to be a guess the number game but i'm stuck with this error. https://repl.it/@JJ_graham/Final-project-Guess-the-number
Voters
TristanMisja (36)
Here, I fixed it:
SixBeeps (3509)
A few things here:
- You have a space before
import time
, which Python doesn't like - You have an incomplete conditional (if statement) at the end, preventing compilation from completing
- I'm no expert in Python, but I don't think '_' is a valid variable name.
Hey @JJ_graham,
You do have several errors here:
_
variable is perfectly valid in Python.I have to assume you want
number
to be a variable which is a random integer between 1 and 10. So, you need to setnumber
like so:And then for your
ans
you need to wrap it in anint()
method to compare the two or convert the number to a string using thestr()
method. I would suggest the latter (usingstr
) as it won't break the script if the user inputs something other than a number, like so:I've got the code stored into a repl that you can check out here: https://repl.it/@heyitsmarcus/Final-project-Guess-the-number1