=== PyBat: Python Batting Practice === based on Nick Parlante's http://javabat.com translations by David MacQuigg http://purl.net/macquigg Free online Python practice problems -- basic logic, strings, loops, lists, dictionaries, and recursion. Practice for an exam, or as homework, or in a lab. == SETUP == You will need a Python interpreter (2.6 or later) from http://python.org Download the entire PyBat package. Make sure this package is on Python's 'sys.path'. Normally this will be true if you start Python in the PyBat directory. Note [1] Contents of PyBat package: DOCS/ help and examples relevant to these practice problems ORIGINALS/ original problems, without code or unittests SOLUTIONS/ completed problems including all unittests UNITTESTS/ modules with just the unittests, no code WIP/ Work in Progress __init.py__ stub needed in every Python package directory IDLE shortcut to Python's builtin IDE [2] PyBat.py test framework program READme.txt this file TEMPLATE.py for writing your own practice problems Copy everything in the ORIGINALS directory to the WIP directory. Keep the originals in case you need a fresh start. Do all your work in the WIP directory. == RUN == Start IDLE in the PyBat directory. Load and run the TEMPLATE.py module from the same directory. All unit tests should pass. Load and run WIP/Warmup1/example.py. It fails all tests. Add your code in the make2 function. All tests should pass. Run the program PyBat.py, and follow the instructions to test the example module. This also runs all the unit tests for that module. Continue writing code and testing other modules, running the modules directly from IDLE. When you are done with a module, run it from PyBat. Did you miss an edge case? A loop that is off by one? Getting the original doctests to work is not enough. You must provide a complete set of unittests that exercise every line of your code, and test every condition that is likely to occur. Your intructor's unitttests will try to find edge cases you have missed. Don't forget to add comments explaining your code and tests. Your instructor may adjust the automated score depending on the clarity and style of your writing. See TEMPLATE.py for an example of a well- written solution. With a few hours practice, you should be batting 1000! i.e. you get every problem right the first time, and never miss an edge case. == CONTRIBUTE == We are looking for problems that have maximum tutorial value. If you have any you would like to see in this package, or even some improvements to the ones we already have, please send them to macquigg ece.arizona.edu. Follow the style in TEMPLATE.py. Be sure to credit any original author, preferably with a link to the original text. == Notes == [1] In Windows, if the IDLE [2] shortcut is not already in the PyBat directory, drag the IDLE icon from the start menu to that directory. Right-click on it, and select Properites. Delete the default path in the 'Start In' field. This will make the PyBat directory the default when IDLE is started from this shortcut. [2] IDLE is the simple Integrated Development Environment that comes with Python - highly recommended over working from a command prompt.