Last active
December 25, 2015 19:49
-
-
Save CaryInVictoria/7030694 to your computer and use it in GitHub Desktop.
Buggy Python code. Objective is to spot errors without running.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def get_dow: | |
>>> dow = input('Enter day of week (0=Sunday, 1=Monday, ...):)' | |
>>> print ("you entered " + str(dow)) | |
>>> if Dow == 2: | |
>>> print("It's Tuesday") | |
>>> else | |
>>> | |
>>> # We won't bother | |
... # checking to see what | |
... # the day of week | |
... # actually is | |
... | |
>>> print('It may be {0}'.format ("Monday") | |
>>> return (dow) | |
>>> | |
... def save_dow(n) | |
>>> """" | |
... Here we are going to get the day of week n times, print the | |
... results and and put | |
... the results | |
... # in a | |
... list | |
... | |
... | |
... """" | |
>>> DOW3 = [] | |
>>> for i in range(0, n) | |
>>> | |
... _ = get_dow | |
>>> if i = 0: | |
>>> DOW3.append(_) | |
>>> elsif i = 1: | |
>>> DOW3.extend([_]) | |
>>> else; | |
>>> DOW3.insert(0,_) | |
>>> | |
>>> | |
>>> print((str(DOW3))) | |
>>> | |
... save_dow(4) # call save_dow 4 times |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment