Skip to content

Instantly share code, notes, and snippets.

@CaryInVictoria
Last active December 25, 2015 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CaryInVictoria/7030694 to your computer and use it in GitHub Desktop.
Save CaryInVictoria/7030694 to your computer and use it in GitHub Desktop.
Buggy Python code. Objective is to spot errors without running.
>>> 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