Controlling Program Flow Using If Statement in Python - 60 Seconds to Code

Veröffentlicht am: 21 März 2020
auf dem Kanal: Faisal Akhtar
19
0

Welcome to 60 seconds to code where I show you how to code in 60 seconds or less.
Today you will learn about controlling the flow of your programs using if statements.
Step 1 – Create a new file called ifstatements.py and type my_var = True
Step 2 – Type
if my_var:
print(‘Value is true’)
else:
print(‘The Value is False’)
as it appears on screen.
Step 3 – Run the program from the terminal
Step 4 – Change the value of the my_var variable to False and run the program again
Step 5 – As you can probably tell, the if statement executes if the given condition is true and the else condition executes if that condition is false.
Step 6 – You can also check the exact same condition by using the double equal sign
Step 7 – Change the second line in the program to if my_var == True: and run the program again.
Congratulations, you’ve learned basic control flow using if statements. Remember to commit and push your code to GitHub and try to code a little every day because CODE IS LIFE
#howto control the flow of logic in your program with if statements #60secondstocode #codeislife


Auf dieser Seite können Sie das Online-Video Controlling Program Flow Using If Statement in Python - 60 Seconds to Code mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Faisal Akhtar 21 März 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 19 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!