+ 1

Hey, can anyone help.. My program is not running when I use break and continue statment, 1st one is running but 2nd and 3 not

1) words = ["hello","shello","fello","sello"] for x in words: print (x) 2) words = ["hello","shello","fello","sello"] for x in words: If x == "fello" break print (x) 3) cars = ["BMW", "Mercedes", "Audi", "Nissan", "Toyota"] for x in cars: if x == "Nissan" continue print (x)

24th Jan 2019, 7:22 AM
Deep singh Sodhi
Deep singh Sodhi - avatar
2 ответов
+ 7
You forgot the : after the if statements 2) words = ["hello","shello","fello","sello"] for x in words: if x == "fello": break print (x) 3) cars = ["BMW", "Mercedes", "Audi", "Nissan", "Toyota"] for x in cars: if x == "Nissan": continue print (x)
24th Jan 2019, 7:34 AM
Uni
Uni - avatar
+ 1
You: Used invalid indenting, Capitalized keyword "if", Forget a ":" after a block statement. They seem all to be typing mistakes.
24th Jan 2019, 10:32 AM
Seb TheS
Seb TheS - avatar