REMEMBER PYTHON

MINTE9
2REMEMBER




While

p123 ! You can almost read while statement as if it were English. While n is greater than 0, display n, then decrement it.
 RunCode
def countdown(n):
    while(n > 0):
        print(n)
        n = n -1

countdown(5) # 5 4 3 2 1
... 5 lines
˄˄˄
p123 Sometimes you want to take input from user until they type quit.
 CodeCopy
while True:
    line = input('> ')
    if (line == 'quit'): 
        break
    print(line)

print('Done')
... 6 lines
˄˄˄

Questions    
No. 14   Approximate
CARD
13
32

        A B C D E F
🔔
1/1