nick34992 of Python
2/2/2017 - 7:19 AM

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

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

#!/usr/bin/python3

num = 0 # variable initialized
while num <= 5: # loop defined
    print('num =', num) # before counter
    num += 1 # counter
print('num =', num, '| outside of loop, after counter') # num = 6, outside of loop

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

num = 0
num = 1
num = 2
num = 3
num = 4
num = 5
num = 6 | outside of loop, after counter
'''