Azad Rasul




7- Control flow in Python

Azad Rasul's photo
Azad Rasul
·Jun 26, 2021·

1 min read

Play this article

The control flow in Python is determined by loops, conditional statements, and function calls.

if ... else

a = 50
b = 100
if a > b: 
    print('a is greater than b')
elif a < b:
    print('a is smaller than b')
    print ('a is equal to b')
# a is smaller than b

Tip: In Python, spaces are the preferred indentation method, not tabs.

while loops

i = 4
while i < 10:
  i += 2
# 4
# 6
# 8

for loops

for x in "Python":
# P
# y
# t
# h
# o
# n

Tip: for loops preferred over while loops.

If you find this content helpful, please consider SUBSCRIBING to my channel for future updates.

If you would like to get the full video tutorial and a certificate, you can enroll in the course by following this link:

Share this