Work on your own. (But reach out to me early and often with questions!)
Submit your work by uploading your hw0.py
file via
MySLC
Use only the Python expressions and statements I have used thus far in class or in examples I have sent or included with this assignment. If you are not sure whether to use a feature, just ask.
Review the guessing games we have discussed in class.
Download the starter file. (Right-click on the link and choose a location to save the file on your computer.)
Write all your code in the file hw0.py
. But don’t
start writing until you have a sense of what is being asked. Read
everything (these instructions, the starter file, the example output)
before beginning to write code.
You are being asked to complete the implementation of seven
little REPLs. They get somewhat more interesting (and somewhat more
challenging) as they progress. Other than the
even_odd_repeater
which relies on even_odd
,
the functions are independent of each other. (You can ignore
read_int
which I have provided at the very bottom of the
file which you need not understand how it works, just how to use
it.)
Read the example output to get a feel for how the games are intended to work. You can create the text that is printed by your programs as you see fit (it need not be identical to the text in the examples).
Replace (YOUR NAME)
with your name in the
comment near the top of the file. (Remove the parentheses,
too.)
Lines that only consist of ...
indicate places where
you should expect to write one or more lines of code from
scratch.
Lines with code that have a # ...
comments at the
end indicate that you should modify the code on that line.
Remove the ...
(and the # ...
comments)
as you go.
Test your work as you go! Use the IDLE Run Module (F5) option after saving your file; then try the functions you are building in the IDLE Shell. (Follow the example output.)
Be sparing with your own comments. Proofread them before submitting.
Take care to format your code to be readable; follow the model of my examples.
Be consistent with formatting, spacing, indentation, and variable naming.
Before submitting: replace ... status ...
comment
near the top of the file with a brief comment as to how much of the
assignment you completed. (For example, “I completed all of the assigned
problems and I am confident they work correctly.” or “I struggled on
many of the problems and have left 3, 5 and 6 blank. There is an error
in 2 so I commented it out. 4 works fine except when the user enters”x”.
1 inexplicably gets stuck in an infinite loop.”)
Hints available upon request!