There are syntax and logic errors. Syntax errors are easy to fix: the interpreter shows you an error message pointing to exactly the location and error.
Traceback (most recent call last):
File "python", line 7
if chute == numero_secreto
^
SyntaxError: invalid syntax
You missed the colon, :
, after if
.
Traceback (most recent call last):
File "python", line 9
else
^
SyntaxError: invalid syntax
You missed the colon after else
.
With these fixes your code will still not work, since the return of the input
function will always be a string , so you will be comparing a string with an integer, which makes no sense and will never be true. Since you want to read an integer, you need to convert the value as such by doing:
chute = int(input("Digite um numero:"))
However, if the user enters any value other than numeric, an exception will be thrown. To resolve this problem, read:
How to make the system display an error message when it is not a number?