Python allows while loops inside while loops and if statements within the body of if statements. code example

Example 1: how to write a while statement in python

myvariable = 10
while myvariable > 0:
  print(myvariable)
  myvariable -= 1

Example 2: infinite while python

#infinite While on Python

while True:
  print('Hello World!')

Example 3: while loop in python

#there are 2 ways to make a while loop in python

#first way -

while True:
  (#what ever you want in the loop)
    
#second way - 
    
while 1:  
    (#what ever you want in the loop)