+ 1

Does anyone know why I’m getting a “‘break’ outside the loop” error in this?

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

21st Oct 2018, 4:40 PM
Jayden Williams
Jayden Williams - avatar
3 Antworten
+ 3
You cannot use break statement in if else as they are conditions and not loops. break can only be used in loops , like while, for , do while etc
21st Oct 2018, 5:06 PM
Frost
Frost - avatar
+ 3
You should put all your if and elif's in your while loop. And user input too.
21st Oct 2018, 5:28 PM
Paul
Paul - avatar
+ 1
you if and while are seperated, because their indent are same remember indentation are important in python
21st Oct 2018, 5:06 PM
Taste
Taste - avatar