0

Guys ...the program always tell me 'break' outside loop ,how do I fix this..still a beginner

https://code.sololearn.com/cehfxtG4E3Yg/?ref=app

10th May 2020, 9:56 AM
Ugonna Muoneme
Ugonna Muoneme - avatar
3 ответов
+ 4
Because of the intendations. Your if statement does not belong to your while loop. Here is a solution: name = '' while name != 'joe': print('enter correct name') name = input() if name == 'joe': break print('hi user')
10th May 2020, 9:59 AM
Denise Roßberg
Denise Roßberg - avatar
+ 2
The indentation is wrong. In Python blocks are defined via equal indentation. In this case the break is not even necessary as the check before is the same as for the loop itself.
10th May 2020, 10:00 AM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
+ 1
Your indents prior to your break place the break outside the while loop. Remember, a break is used inside a loop, so your indents must be within the loop
10th May 2020, 10:01 AM
Rik Wittkopp
Rik Wittkopp - avatar