There are errors of syntax and logic. Syntax errors are easy to fix: the interpreter shows an error message pointing exactly to the location and error.
Traceback (most recent call last):
File "python", line 7
if chute == numero_secreto
^
SyntaxError: invalid syntax
You missed two stitches, :
, after the if
.
Traceback (most recent call last):
File "python", line 9
else
^
SyntaxError: invalid syntax
Missed both points after the else
.
With these fixes your code will not work yet, because the function return input
will always be a string, then you’ll be comparing a string with an integer, which makes no sense and will never be true. As you want to read an integer, you need to convert the value as such by doing:
chute = int(input("Digite um numero:"))
However, this way, if the user enters with any value that is not numerical, an exception will be triggered. To solve this problem, read:
How to make the system display an error message when it is not number?
Have you read the error messages? They have written what is wrong.
– Woss
I read but don’t understand
– wesegegweg