1. A player rolls two six-sided dice and adds the numbers rolled together.
2. On this first roll, a 7 or an 11 automatically wins, and a 2, 3, or 12 automatically loses, and play is over. If a 4, 5, 6, 8, 9, or 10 are rolled on this first roll, that number becomes the "point.”
3. The player continues to roll the two dice again until one of two things happens: either they roll the "point" again, in which case they win; or they roll a 7, in which case they lose.
Playing craps can include a number of variations on this game, and also typically involves betting on various outcomes.
Have some fun with different library functions by figuring out how to get Python to:
- Print out a calendar of the month you were born
- Tell you how many days it is until your next birthday
- What day of the week was the Declaration of Independence ratified by the Continental Congress? (write a program that prints out Monday, Tuesday, etc)
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.import random
roll = [random.randint(1,6) for i in range(n)]
total = sum(roll)
print("Player rolls "+str(roll)+" = "+str(total))
print("*** CRAPS GAME ***")
total = roll_dice(2)
if total in [7, 11]:
print("Player automatically wins!")
elif total in [2, 3, 12]:
print("Player automatically loses!")
point = total
By purchasing this solution you'll be able to access the following files: