Week 1 (Chapters 1):
· Ch. 1, Proj. 1 – ice_cream_bad.py, ice_cream.py
· Ch. 1, Proj. 2 – name.py
· Ch. 1, Proj. 3 – quote.py
Extra:
· Ch. 2, Proj. 1 – variable_names.txt (3 legal names, 3 illegal names, 3 good legal names, 3 bad legal names, with explanations)
· Ch. 2, Proj. 2 – foods.py
Week 2 (Chapter 2)
· Ch. 2, Proj. 3 – average.py
· Ch. 2, Proj. 4 – tip.py
· Ch. 2, Proj. 5 – adventure.py
Week 3 (Chapter 3):
· Ch. 3, Proj. 3 – guess.py
· Ch. 3, Proj. 4 – nim.txt
· Ch. 3, Proj. 5 – nim.py
Extra:
· Ch. 3, Proj. 1 – score.py
· Ch. 3, Proj. 2 – flip.py
Week 4 (Chapter 4):
· Ch. 4, Proj. 4 – cards.py (Notice you need to use tuples, not strings.)
· Ch. 4, Proj. 5 – jumble.py
· Ch. 4 – ixtlan.py
Extra:
· Ch. 4, Proj. 1 – vowels.py
· Ch. 4, Proj. 2 – tnirp.py
· Ch. 4, Proj. 3 – rancard.py (Notice you need to use tuples, not strings.)
ixtlan.py: Given the following phrase tuple and word to be removed from the phrase, write a program to create a string containing all the words in the tuple, print it, and then create and print a string containing all of the words in the tuple except the word you are supposed to remove. To receive credit you must use "slice" functionality to extract the words from the phrase tuple when creating the second, edited string. This means you'll need to use start and stop indexes.
Here are the phrase tuple and word to be removed:
Phrase = ( "Now", "Ixtlan", "we", "can", "Ixtlan", "read", "this", "Ixtlan", "sentence!" )
Remove = "Ixtlan"
Here is a sample run of ixtlan.py:
The unedited phrase is: Now Ixtlan we can Ixtlan read this Ixtlan sentence!
The edited phrase is: Now we can read this sentence!
Week 5 (Chapter 5):
· Ch. 5, Proj. 4 – sort.py
· Ch. 5, Proj. 5 – geneology.py
extra:
· Ch. 5, Proj. 1 – faves.py
· Ch. 5, Proj. 2 – directions.py
· Ch. 5, Proj. 3 – jumble2.py (Notice you need to use a nested sequence for the hints, not a separate tuple.)
Week 6 (Chapter 6):
· Ch. 6, Proj. 3 – first_second.py
· Ch. 6, Proj. 4 – guessfun.py
· Ch. 6, Proj. 5 – jumblefun.py (There is a bug in the code shown in the textbook: The call to jumble() should have "the_word" as its argument, not "word". You may start from either Week 3’s jumble.py or Week 4’s jumble2.py, but do include hints. If you start from Week 4's version, with its list of tuples, you may want to change the definition of random_word() to return a tuple instead of just a word, and assign its return value to the_word, the_hint, and then change the definition of play() so you pass in the_hint, in addition to the_word and the_jumble. It is acceptable to make these changes from the textbook's statement of the problem. If you stick with the textbook's definitions of these functions, you will probably need to change the main data structure from a list of tuples to either a dictionary—in which case you can look up the hint using the correct word as the key—or a pair of lists, one for the WORDS, the other for the HINTS, and get the index to use in HINTS by looking up the index of the word in WORDS, using something like WORDS.index(the_word).)
Extra:
· Ch. 6, Proj. 1 – scorefun.py
· Ch. 6, Proj. 2 – scorefun2.py
Week 7 (Chapter 7):
· Ch. 7, Proj. 3 – trivia.py
· Ch. 7, Proj. 4 – multitrivia.py
· Ch. 7, Proj. 5 – python_files.trv
Extra:
· Ch. 7, Proj. 1 – scores_pickle.py (Start from Chapter 5’s "high_scores2.py", not "high_scores.py". If you move the main body of the code into a function, be warned that the way he truncates the best scores list, by slicing scores[:5] produces a new list, as a result of which the resulting sliced list will be local to the function and will not propagate back to the calling routine. You can solve this by making score a global variable—a bad way—or by changing the way the list is truncated to use scores.pop()—the preferred way. If you don’t use functions, this won’t matter.)
· Ch. 7, Proj. 2 – scores_text.py (Don’t forget str(), to turn an int into a string. If you read the name back in with readline(), it will have a newline on the end that you can get rid of with strip()—don’t forget that strip() produces a new string because strings are immutable, so you’ll need an assignment statement. When you write the values out with write() you’ll need to put your own newlines on each line.)
Week 8:
· Review & Midterm Exam. Midterm exam in lab!
Week 9 (Chapter 8):
· Ch. 8, Proj. 3 – player.py (Define the Player class so a player object can be created with a unique name, maximum inventory size, and initial list of items in the player’s inventory. Create a default player; have the player take items; try to add more items than the player can hold; have the player drop an item; have the player take an item that was not in the inventory previously. Call the player’s inventory function when the player is first instantiated and again after each change to the inventory. Finally, create an instance of a player using non-default values for the name, maximum number of items, and initial item list.)
· Ch. 8, Proj. 5 – tv.py
extra:
· Ch. 8, Proj. 1 – critter.py
· Ch. 8, Proj. 2 – spaceship.py (Show how to use no parameters, each single parameter, and both parameters to instantiate a ship.)
· Ch. 8, Proj. 4 – spaceship2.py
Week 10: Spring Recess
Week 11 (Chapter 9, Projects 1-3):
· Ch. 9, Proj. 1 – blackjack2.py
· Ch. 9, Proj. 2 – weapon.py (Instantiate a Sword that causes 5 points of damage, and swing it twice.)
· Ch. 9, Proj. 3 – weapons.py (Instantiate a Sword that causes 5 points of damage and swing it twice. Then instantiate a Crossbow that causes 10 points of damage and fire it twice in a row, reload it twice in a row, fire it, reload it, and fire it, all in that order.)
Week 12 (Chapter 9, Projects 4-5):
· Ch. 9, Proj. 4 – blaster.py (Instantiate an Alien that starts with 5 units of health and a Player that blasts it 6 times. To be sure all your code is working, try instantiating the Player with 4, 5, and 6 units of ammo, and pay attention to the results.)
· Ch. 9, Proj. 5 – blackjack3.py (Take all players' bets before dealing any cards.)
Week 13 (Chapter 10):
· Ch. 10, Proj. 3 – rps.py (Be sure to handle the problem case when a user clicks the "Fight!" button without having made their choice between Rock, Paper, and Scissors. Make sure the text of the Rock, Paper, and Scissors radio buttons is capitalized. Be sure to show the outcome of the match. You can make the logic a bit easier on yourself if you first deal with the case when the computer's choice matches the player's choice, and thus produces a draw, regardless of what they actually selected.)
· Ch. 10, Proj. 4 – burger.py (A measly two points will be deducted if the grammar, including punctuation, is incorrect. You may use the "Oxford comma" or not.)
· Ch. 10, Proj. 5 – password.py
Extra:
· Ch. 10, Proj. 1 – color.py (On Macs, the button background does NOT change color. In addition to changing the "bg" widget option, also set the button's text to the color name.)
· Ch. 10, Proj. 2 – grid.py (See if you can get your program to display a grid of an arbitrary NUM_COLUMNS x NUM_ROWS using an appropriate window size; i.e., a window size that is only a little bit larger than is actually needed to display the gridded text.)
Week 14 (Chapter 11):
Download and use the .bmp files in these project files instead of the .jpg files provided with the book.
· Ch. 11, Proj. 4 – cpong.txt
· Ch. 11, Proj. 5 – cpong.py (For consistency, place the paddle on the left, 10 pixels in from the edge, and place new balls on the right edge. Make the balls start at random heights, with random dy values between -4 and 4, inclusive, and random dx values between -1 and -3. Hint: If you have trouble with a flurry of balls being created at once, it's probably because when the ball bounces, under certain conditions, it is still on top of the paddle, which can cause it to bounce again and again and again... This should suggest an easy fix. Hint: The paddle width is 16 pixels; the ball width is 12 pixels. See if you can implement an accurate score functionality and display it where the background image indicates. Score one point per ball successfully bounced with the paddle.)
Extra:
· Ch. 11, Proj. 1 – avalanche.txt
· Ch. 11, Proj. 2 – avalanche.py (Rocks can just fall straight down and always start in random locations. Add any background you want; "wall.bmp" is okay. Be sure to turn in whatever background you use if it is different from what the book provides.)
· Ch. 11, Proj. 3 – avalanche2.py
Week 15 (Chapter 12):
Download and use the .bmp files in these project files instead of the .jpg files provided with the book.
· Ch. 12, Proj. 3 – swarm.txt
· Ch. 12, Proj. 4 – swarm.py (Don't let the missiles fire too fast, as in AstroCrash. Play missile and explosion sounds. Whether you play theme music in the background, and what that theme music is is up to you. And you can use whatever background you want. Be sure to turn in whatever music and background you use if they are different from what the book provides.)
· Ch. 12, Proj. 5 – swarm2.py
Extra:
· Ch. 12, Proj. 1 – cpong2.txt
· Ch. 12, Proj. 2 – cpong2.py (Start with a single Bounce_Ball. You may want to only create a new ball when a Bounce_Ball has been hit by the paddle, just to make the game a little easier to play.)
Week 16:
· Free week to work on final game project.