Question: Help with Python program to play CRAPS on the computer. There must be a function rollem that rolls two dice, using the random.randint function. (5

Help with Python program to play CRAPS on the computer.

There must be a function "rollem" that rolls two dice, using the random.randint function. (5 lines of code) There are no parameters and returns 3 values. (each die and the total)

There must be a function "showme" that prints the result of the roll. There are three parameters but doesnt return anything and prints: "You rolled a 5 and a 2 for a total of 7".

There must be a main function that provides logic for CRAPS. The rules/process:

- Roll two dice. Call the rollem function to do this and save what is returned.

- Display the results. Call the showme function passing the info you got from rollem().

- If the total is 7 or 11, print Congrats, you win..

- Else if the total is 2, 3, or 12, print Too bad, you lose..

- Else: print The point is X., where X is the total of the roll. Assign the value of total to a variable named point.Set again to True.While again==True, do the following until player wins or loses:

- Print "You are still alive!! Let's roll again!!"

- Roll the die again.

- Display the results

- If the new total matches point, print Congrats, you win. Set again to False

- Else if new total is a 7, print Too bad, you lose. And set again to False.

- Else continue.

- Invite the user to play the game again.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!