Free Python tutorial for beginners - Python While Loop Mastery Next-Level Tips and Tricks
Subscribe Here -https://www.youtube.com/@KeeshtuTechn...
#pythonenglish #pythonprogramming #pythontutorial #pythonforbeginners #youtubechannel #pythoninstallationcomplete #pythonhowtoinstall #pythoninstall #pythondownload #pythontutorialfree #pythonyoutube #pythonenglish #pythonenglish #pythonexecvseval #pythonexec()vseval() #pythonexec() #pythoneval() #youtubeviews #pythonbreak #pythoncontinue #pythonpass
Please Captions on - Python in English, Python in Tamil, Python in Telugu, Python in Malayalam, Python in Chinese, Python in Japanese, Python in German, Python in Hindi, Python in French
--------------------------------
hello welcome to technology platform so today we are going to see like um while loop so how we can use it some while loop with tips and tricks so normally we can use everyone knows like how to use it while loop but some tips and tricks we can see it in the today session let me open idle
so normal while loop is like x equal to zero first I am declaring the variable and then while X less than or 10 colon is must and then we need to increment like x equal to X Plus 1 otherwise this will go and infinite Loop let me show that as well now print of x
now you can see like one two three four five six seven eight nine ten now if you give like this while X less than 10 and then in you haven't given that incremental but you just given printed now what happened let's see it is never ending Loop so it will go as an infinite Loop it never ends so because of that you will always use like the incremental in the while loop but in for Loop that is auto incremental so you no need to do that let me open idle again let me close this
close the program because this will hang so because of that you should always use while loop with the incremental values let me open some other Idol
yeah so now you always use like some while X less than r10 but I don't want to use like this let's see x equal to 10 I'm just giving this value now enter while X colon [Music] I am not giving any values that means this will take like x equal to true that means x equal to 10 like this this is what we need to consider if I am not giving anything here simply use the variable then it will consider this x value is true so then automatically it will go inside in the loop let's see now X enter I'll say like x equal to x minus 1. I want to print it uh iteration in a reverse order let's see now print takes and then enter so it just printed in a reverse order with 10 times but you never mention anything here but however it just worked so that means this x equal to true then it automatically enter into this now I want to do some tricks like I will say like entering the password if it is five times I attempted after five times attempted it should say like your account locked are within the five attempts I just entered the right password then it I should get the right message now let's see how we can do it here I just say like x equal to 5 declaring something like this while X
and then I can say like x equal to True like this
um or I can say like X are equal to 5 like this you can use it anything is fine or x equal to this one is also fine x equal to x minus 1. now I'll take like password input
I'm asking the password to the user enter the password and then if password equal to python
then I should get a message like colon is missing
x equal to 5
while this one and then print log and successfully
and then break stop the process here itself next
if it is not then we can say like print of X comma then space first attempt
left like that four attempts left five atoms left like that I want to say here I just print it
after that all atoms are left over then I should display like else your account locked
now let's see this
enter the password T just typing t 4 atoms left t three atoms left two attempts left your account locked like this now x equal to 5 .
I have to use it the same thing okay because this Arrow Mark is not here that's why you are getting an error message x equal to 5 enter now you can paste it here
enter the password t TT now entering the right password python login successfully it is login successfully and then it just come out from the loop let's see you in the next session thank you bye
In questa pagina del sito puoi guardare il video online Python tutorial - Python While Loop - How to use While Loop in python della durata di ore minuti seconda in buona qualità , che l'utente ha caricato KeeshtuTechnology 13 agosto 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 35 volte e gli è piaciuto 0 spettatori. Buona visione!