Fix up your HW1 and HW2 to the state of satisfying Travis (and me)
Use them to raise question/discussion. You can subscribe to repository, or specific thread
psyc161-hw2 repository is private now, so
nose --with-coverage
locally)Send me an email with screenshot or copy-paste from the terminal which "presents" the problem. Don't try to go into elaborate descriptions without original error message/traceback/etc.
Step 1. Blame Yarik
Step 2. Add original homework repository as an additional remote (if you haven't done so)
Step 3. Merge my master
Step 4. Push again
Should we set some fixed hours or let's just keep doing it flexible "on demand/availability"?
If I have a function which uses e.g. raw_input
:
def func_which_calls_raw_input(args):
response = raw_input()
return args + response
func_which_calls_raw_input("bogus")
but I want to test that function in non-interactive session I can make an argument defaulting to raw_input
, which would behave identical
def func_which_calls_raw_input(args, input_func=raw_input):
response = input_func()
return args + response
func_which_calls_raw_input("bogus")
but also would allow to "fake" inputs:
def return1():
return '1'
func_which_calls_raw_input("bogus", input_func=return1)
Excercise
We need to pass a function which would upon each call return a new value from a series of predefined outputs. E.g. first time it should return '1', then 'a', ... . How can we create such a function?
Logistically speaking, we haven't learned yet classes or generators, which could provide us an ultimate solution, so let's just recall our earlier classes and scopes of variables and operations on lists. Implement a function which on the first run outputs "1", on the 2nd "a", and on the 3rd one "done". It would be ok to crash with some exception if it is called 4th time.