nick34992
1/11/2017 - 11:03 PM

MITx 600.1x | Week 1 | Python Basics | 2. Core Elements of Programs | Exercise: while: Item 1

MITx 600.1x | Week 1 | Python Basics | 2. Core Elements of Programs | Exercise: while: Item 1

#!/usr/bin/python3

num = 2  # initialize in global namespace
while num < 11:  # define conditional loop
    print('num =', num)  # before counter
    num += 2  # counter
print("Goodbye!")  # global frame

'''
MITx 600.1x | Week 1 | Python Basics | 2. Core Elements of Programs | Exercise while: Item 1

num = 2
num = 4
num = 6
num = 8
num = 10
Goodbye!
'''