K
K
Kira2021-06-17 03:37:06
Python
Kira, 2021-06-17 03:37:06

Syntax error in the condition, what's wrong here?

else answer.upper() != password:
SyntaxError: invalid syntax

text = 'qwq'

answer = input ("password" + " ")
if answer.upper() == text:
  print("yes")

else answer.upper() != text:
  	print("неверный пароль")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GrrAble0902, 2021-06-17
@kirashoo42

After else you have a condition, replace else with elif.
Valid code:

text = 'qwq'

answer = input ("password" + " ")
if answer.upper() == text:
  print("yes")

elif answer.upper() != text:
  	print("неверный пароль")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question