1#there are 2 ways to make a while loop in python
2
3#first way -
4
5while True:
6 (#what ever you want in the loop)
7
8#second way -
9
10while 1:
11 (#what ever you want in the loop)
1target = 100
2current = 0
3
4while current != target:
5 current += 1
6 print(current)
7
8#The while loop repeats the indented code while its condition is true
9#(current IS NOT equal to target).
10
11else:
12 print("Target Reached!")
13
14#When the while loop condition is no longer true (current IS equal to target),
15#the indented code under else: is ran.
1while <Condition>:
2 <code>
3
4 #example
5 i = 10
6 while i == 10:
7 print("Hello World!")