python program to count from 1 million to 0

Solutions on MaxInterview for python program to count from 1 million to 0 by the best coders in the world

showing results for - "python program to count from 1 million to 0"
Alaina
24 Feb 2018
1#the bug is that it does not stop counting!
2import time
3n = 0
4
5
6while ( n <= 1000000):
7    n = n + 1
8    print(n)
9    time.sleep(0) #you can change the sleep to the number of seconds you want
10    
11else:
12    n == 1
13
14print("finished!")
15
Taylor
26 Jun 2018
1#counting from 1 million to 1, using while loop
2import time
3n = 1000000
4
5
6while ( n <= 1000000):
7    n = n - 1
8    print(n)
9    time.sleep(0)
10    
11else:
12    n == 1
13
14print("finished!")
15
16