CS 30 Homework 5

Due by class time Wednesday, March 8

If you wish, you may work with a partner on this assignment.

Reading

Practice Exercises (Optional)

These problems are recommended if you feel the need for some extra programming practice using decisions and loops in Python, but they are not required.

Problems to Turn In

  1. Finish the exercises from Lab 6. Name your programs as follows:

  2. Now modify your Rock-Paper-Scissors program so that, unknown to the user, the computer occasionally cheats by changing its own choice after the user has entered theirs. This should happen with a probability of 30%.

  3. Write a program called craps that simulates the casino game of Craps, which is played as follows. You start by rolling two dice and looking at the total. The game then breaks down into the following cases based on that first roll:

Extra Credit

You should finish the other problems first before attempting these.

Turning in Your Homework

Put all of your code into a single file called assign5.py. Include your name at the top of the file as a comment, and submit it using /common/cs/submit/cs30-submit. Be sure to run this command from the directory containing your file.

If you have questions about anything, don't hesitate to ask!