Skip to content

Instantly share code, notes, and snippets.

@stephaniemdavis
Last active June 23, 2018 12:48
Show Gist options
  • Save stephaniemdavis/f08e0759c5947a736a00d1228d30af06 to your computer and use it in GitHub Desktop.
Save stephaniemdavis/f08e0759c5947a736a00d1228d30af06 to your computer and use it in GitHub Desktop.
A simple for loop. For loops only work on iterables
'''
Written 6-23-2018 s.m.d Implementation of EdX Introduction to Computation & Programming Using Python
Convert the following code into code that uses a for loop.
prints 2
prints 4
prints 6
prints 8
prints 10
prints "Goodbye!"
'''
# for loops only work on iterables!!!!!
def easy_for():
for i in range(2,11,2):
print(i)
print('Goodbye!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment