Question
please use python and provide run result, thank you!
For this assignment you will have to investigate the use of the Python random librarys random generator function, random.ran
The Global-Scope Client Functions Each global-scope function that you write to simulate this casino app plays a special role.
def display the_pull winnings: This method takes the winnings (e dollaramount and the_pull as parameters and display the thre
Sample Output Here is an example of a partial run sample (although some numbers and details are not based on the ecact requir

click on pic to make it bigger
For this assignment you will have to investigate the use of the Python random librarys random generator function, random.ran
The Global-Scope Client Functions Each global-scope function that you write to simulate this casino app plays a special role.
def display the_pull winnings: This method takes the winnings (e dollaramount and the_pull as parameters and display the thre
Sample Output Here is an example of a partial run sample (although some numbers and details are not based on the ecact requir


O BAR O space Understand the Application What it Looks Like to the User The program will loop, asking the user for a bet amou
A Helper Class: TripleString For this assignment we use our previous class TripleString. You can use your version with correc
The Program Spec The Global Scope Function Specs def get_bet(): This prompts the user for input and returns the bet amount as
def get_pay_multiplier(the_pull): After main gets a TripleString object from pull() (which I will call the_pull), it needs to
Test Run Requirements: Submit one run that lasts a minimum of 40 pulls, but possibly more (continue reading). At least once e
Sample Output Here is an example of a partial run sample (although some numbers and details are not based on the exact requir
cherries, 7 BAR congratulations, you win: 10. How much would you like to bet (1 - 50) or to quit? 2 whirrrrrr .... and your p
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:
Please find below the code, screenshot and output screens for program.
1. Code that can be copied.

#Casino_Game
import random
#Condition to be checked

def pull(user_bet):
print("whirrrrr.....and your pull is....")
priority=[38,40,7,15]
list_pull=["BAR","7","Cherries", "Space"]
new_list=random.choices(list_pull, priority, k=3)
print(new_list)
return new_list
  
def get_bet():
print("----------------------Run--------------------------------")
for i in range(40):
user_bet=input("How much would you like to bet (1-50) or 0 to quit! ")
try:
if user_bet=="0":
print("Thanks for coming to Casino Loceff")
break
elif int(user_bet)>0 and int(user_bet)<51:
k=pull(user_bet)
display(k)
except ValueError:
print("Enter valid values")

#Slot machine pull.
def display(new_list):
if new_list[0]=="Cherries" and new_list[1]!="Cherries":
print("\nCongratulations, You WIN: ",5*user_bet)
elif new_list[0]=="Cherries" and new_list[1]=="Cherries" and new_list[2]!="Cherries":
print("\nCongratulations, You WIN: ",15*user_bet)
elif new_list[0]=="Cherries" and new_list[1]=="Cherries" and new_list[2]=="Cherries":
print("\nCongratulations, You WIN: ",30*user_bet)
elif new_list[0]=="BAR" and new_list[1]=="BAR" and new_list[2]!="BAR":
print("\nCongratulations, You WIN: ",50*user_bet)
elif new_list[0]=="7" and new_list[1]=="7" and new_list[2]!="7":
print("\nCongratulations, You WIN: ",100*user_bet)
else:
print("Sorry you loose...")

#Calling to initialize the game
get_bet()

2. Screenshot of the code.


3. Output screens.

Please note:
1. try block is used to deal with user input other than o and 50.
2. Program will run 40 times, for quitting 0 should be used.

Thanks.

Add a comment
Know the answer?
Add Answer to:
please use python and provide run result, thank you! click on pic to make it bigger...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For this lab you will write a Java program that plays the dice game High-Low. In...

    For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------ ------ High 1 x Wager Low 1 x Wager Sevens 4 x...

  • IN PYTHON Assignment Overview This assignment will give you experience on the use of classes. Understand...

    IN PYTHON Assignment Overview This assignment will give you experience on the use of classes. Understand the Application The assignment is to first create a class calledTripleString.TripleStringwill consist of threeinstance attribute strings as its basic data. It will also contain a few instance methods to support that data. Once defined, we will use it to instantiate TripleString objects that can be used in our main program. TripleString will contain three member strings as its main data: string1, string2, and string3....

  • Java Program Note: no break statements or switch staements High, Low, Sevens For this lab you...

    Java Program Note: no break statements or switch staements High, Low, Sevens For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------...

  • Python 3 coding with AWS/Ide. Objective: The purpose of this lab is for you to become familiar with Python’s built-in te...

    Python 3 coding with AWS/Ide. Objective: The purpose of this lab is for you to become familiar with Python’s built-in text container -- class str-- and lists containing multiple strings. One of the advantages of the str class is that, to the programmer, strings in your code may be treated in a manner that is similar to how numbers are treated. Just like ints, floats, a string object (i.e., variable) may be initialized with a literal value or the contents...

  • Just do program 6 using c++ which are printf and scanf. Please don’t use cout and...

    Just do program 6 using c++ which are printf and scanf. Please don’t use cout and cin. Program 4: A slot machine has three windows. A random fruit is picked for each window from cherry apple, lemon, and orange. If all three windows match, the user wins 8 times the bet amount. If the first two windows only are cherries, the user wins 3 times the bet amount. If the first window is a cherry and the second window is...

  • Write a Python program to create userids: You work for a small company that keeps the...

    Write a Python program to create userids: You work for a small company that keeps the following information about its clients: • first name • last name • a user code assigned by your company. The information is stored in a file clients.txt with the information for each client on one line (last name first), with commas between the parts. In the clients.txt file is: Jones, Sally,00345 Lin,Nenya,00548 Fule,A,00000 Your job is to create a program assign usernames for a...

  • programming language: C++ *Include Line Documenatations* Overview For this assignment, write a program that will simulate...

    programming language: C++ *Include Line Documenatations* Overview For this assignment, write a program that will simulate a game of Roulette. Roulette is a casino game of chance where a player may choose to place bets on either a single number, the colors red or black, or whether a number is even or odd. (Note: bets may also be placed on a range of numbers, but we will not cover that situation in this program.) A winning number and color is...

  • Please use Python 3, thank you~ Write a program that: Defines a function called find_item_in_grid, as...

    Please use Python 3, thank you~ Write a program that: Defines a function called find_item_in_grid, as described below. Calls the function find_item_in_grid and prints the result. The find_item_in_grid function should have one parameter, which it should assume is a list of lists (a 2D list). The function should ask the user for a row number and a column number. It should return (not print) the item in the 2D list at the row and column specified by the user. The...

  • It's in Python 3. Please make sure it displays correct strings lenght And displays correct character...

    It's in Python 3. Please make sure it displays correct strings lenght And displays correct character lenght 1 def sum list(numbers): Sums a list of integers param numbers: a list of intege rs return: the sum of the integers in numbe rs def get_string_lengths (st rings) : 10 11 Given a list of strings, return a list of intege rs representing the lengths of the input strings :param strings: a list of strings return: a list of integers represent ing...

  • I need the following written in Java please, thank you ' We want you to implement...

    I need the following written in Java please, thank you ' We want you to implement a java class that will show details on users and throw exceptions where needed. The following requirements specify what fields you are expected to implement in your User class: - A private String firstName that specifies the first name of the user - A private String lastName that specifies the last name of the user - A private int age that specifies user's age...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT