K
K
Kaiki Hawaiian2020-08-06 23:31:35
Python
Kaiki Hawaiian, 2020-08-06 23:31:35

Syntax error when using break in a while loop, how to fix?

while True :
    s=(input("Введите что-нибудь : ")
    if s =='выход' :
        break
    print("Длина строки", len(s))
print("Завершение")

Error text:
line 3
if s =='exit' :
^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SKEPTIC, 2020-08-06
@daddy_the_heaven

So blet. What are the retreats?
Yes, and the extra bracket Which is after the sign =
s=(input("Введите что-нибудь : ")

G
Guerro69, 2020-08-06
@Guerro69

fix the extra indents, this is how it should be
if s == 'выход':

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question