Python Conditional Statement inside a for Loop

preview_player
Показать описание
Putting an if-else conditional statement inside a for loop to repeate a specified amount of times and using a break statement.
Рекомендации по теме
Комментарии
Автор

This was exactly what I was looking for. Perfectly explained. Thank you so much!

beckybonny
Автор

I hve been searching for an explanation all over YouTube urs was the precise solution and understanding to my problem. Thankyou

vanshjain
Автор

Nice video. You deserved so many likes and subscribers. 👍👍 Keep it up. I’m one of your subscribers now

geek-diallo
Автор

Thanks bro, I am a student and just started python and was doing a personal programming and your video helped a lot, thanks

HeroKat_
Автор

Yeah but isn't it a bad practice to use breaks to exit loops? Isn't the "correct" way setting up a exit condition within the loop (like int i < 3) that exits you instead?

The_Ostrich
Автор

password = input("enter thr password : ")
for i in range(2):
if password != "python":
print ( "wrong password remain attemp ", 2-i)
password = input("enter thr password : ")
elif password =="python":
print('WELCOME')
break

lilyfullery