Question
Casino Royale offers its customers 2 ways to go home with big bucks playing its
“Guess The Number” and “Dice” games.

The dice game is played by asking customer to guess a number between 1 and 10. If customers correctly guess the number they win and the odds are 10 to 1 so that if customers bet 1 dollar and win, they receive 11 dollars.

The dice game is played by asking customers to roll a pair of dice. If customers roll a seven or 11, they win; any other roll and the customer loses. The odds of rolling a seven is 6 to 1 so that if customers bet 1 dollar and win, they receive 7 dollars. The odds of rolling an eleven are 18 to 1 so that if customers bet 1 dollar and win, they receive nineteen dollars.

Upon entering the casino, customers must be greeted with an appropriate welcoming message. They must be asked to indicate which game they want to play and the amount of money that is in their bankroll to play. Customers cannot enter the casino with a bankroll greater than $1,000. Customers must play the games in rounds of 10 plays and the minimum bet for each play is 5 dollars; the maximum bet is 50 dollars.

For each try at either guessing a number, or rolling the dice, customers must be asked how much they want to bet and for each try must be informed of the result and the changes to their bankroll.

At the end of each round, customers must be informed of the amount in their bankroll and whether they want to continue playing or switch to another game or leave the casino.

If customers lose all their money during the course of playing a round, they must be informed that they are busted and be told to leave the casino and go home.

When customers are leaving the casino, they must be informed of how many rounds of “Guess The Number” was played and how much money was lost or won. The same must be done for the Dice game.

Upon leaving the casino, customers must also be given a departing message and the message should be appropriate based on their winnings or losses.
Solution Preview

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

'''
Casino Royale Program
'''

# Function to play "Guess the Number"
def playGuessTheNumber(bankroll, guess_rounds):
    for i in range(10):
       guess_rounds += 1
       print("\"Guess the Number\" - Round #" + str(i+1))
       while True:
            try:
                bet = int(input("Enter bet (5-50): "))
                if bet >= 5 and bet <= 50:
                   break
                else:
                   print("Error: Invalid bet")
            except:
                print("Error: Invalid input")
       while True:
            try:
                guess = int(input("Enter number to guess (1-10): "))
                if guess >= 1 and guess <= 10:
                   break
                else:
                   print("Error: Invalid guess")
            except:
                print("Error: Invalid input")
       number = random.randint(1,10)
       print("The number is " + str(number))
       if guess == number:
This is only a preview of the solution.
Please use the purchase button to see the entire solution.
By purchasing this solution you'll be able to access the following files:
Solution.py
Purchase Solution
$45.00
Google Pay
Amazon
Paypal
Mastercard
Visacard
Discover
Amex
View Available Computer Science Tutors 641 tutors matched
Ionut
(ionut)
Master of Computer Science
Hi! MSc Applied Informatics & Computer Science Engineer. Practical experience in many CS & IT branches.Research work & homework
5/5 (6,803+ sessions)
1 hour avg response
$15-$50 hourly rate
Pranay
(math1983)
Doctor of Philosophy (PhD)
Ph.D. in mathematics and working as an Assistant Professor in University. I can provide help in mathematics, statistics and allied areas.
4.6/5 (6,660+ sessions)
1 hour avg response
$40-$50 hourly rate
Leo
(Leo)
Doctor of Philosophy (PhD)
Hi! I have been a professor in New York and taught in a math department and in an applied math department.
4.9/5 (6,421+ sessions)
2 hours avg response

Similar Homework Solutions