-
Notifications
You must be signed in to change notification settings - Fork 20
Exercise Programming
Kenny Yu edited this page Nov 4, 2013
·
4 revisions
- Make sure you've already done the Hello World Exercise
- Make sure you've read through the Control Flow and Data Structures pages.
Go into the exercises-more
directory. You should see exercises.py
and tests.py
.
Open up exercises.py
. You should see problems and several functions that return dummy values right now.
To run all the tests:
python tests.py
You should see a whole bunch of failures.
To run a specific test, run this command:
python -m unittest tests.TestNumWords
where you can replace TestNumWords
with anything that has the class
keyword before it in tests.py
(e.g. TestNumWords
, TestSumList
, TestAppears
, etc.). These will run tests for the corresponding function in exercises.py
.
Your goal is to finish all the functions in exercises.py and to make all these tests pass. Once all the tests pass, you should see this output when you run python tests.py
:
.............................
----------------------------------------------------------------------
Ran 29 tests in 0.002s
OK