Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 4: Still Feeling Lucky? Due: Friday, Feb. 15th at 1 PM Objective Property use variables, constants, if statements, and while loops in a Python

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Lab 4: Still Feeling Lucky? Due: Friday, Feb. 15th at 1 PM Objective Property use variables, constants, if statements, and while loops in a Python program to determine values off of random numbers. Background: Slot machines are simple games in casinos that determine scores based (mostly) random values. The different combinations are tied to various retums you may get that are also based on your bet. off of In this lab, you will be programming a simple slot machine game that generates three random values and determines a point value. The point values are broken down as follows 1. Three 7's: 750 points 2. Three same values: 250 points 3. Two 7s: 100 points 4. Two same values: 50 points 5. One 7 -10 points 6. Three distinct values: -20 points Each of these cases is discrete. That is, only one can happen at a single time. For example, you generate 7 76, you will receive the 100 point reward. You will not include the extra points for having two of the same numbers, etc. J. r, 1 14 +) 100% The above is exactly the same as the Lab 3. I have left it here so you need not flip back and forth to remember. This lab is an extension: you will now allow the user to run the game multiple times to accrue points, and notify them if the points get too high or too low Instructions: For this lab, you will program in this functionality with Python in a simple way. The program flow should be as follows 1. Print a welcome message 2. Ask the user if they want to play a. If no, then quit the program b. If anything other than yeso is entered, notify the user of error and allow them to enter again. They should be able to input incorrectly an infinite amount of times. c. You should allow any variant of yeso (consider the "lower" function from lecture, now also allow for spaces around the yes or no). 3. Generate three random values 4. Show the user the numbers they have spun. 6. If the user received negative points, print a negative message. If positive, print a positive a Use the code provided in the given file 5. Calculate the point values based on the rules above. message 7. Print the final point value to the user 8. Add the points values to the user's total points 2 14 9. Print the total points. 10. If the user accrues 500 or more points, print "No when to quitl" and exit the program. 11.If the user accrues-1000 or less points, print "You're in too much debti and exit the program. 12. Continue until the user wants to quit REMEMBER TO RUN THE setup py develop BEFORE YOU BEGINI Example run: Below is several runs: Welcome to your slot machine! Would you like to play? Enter yeso: no Goodbye! Austins-MacBook-Pro:Lab4 austingrahams run lab4 Welcome to your slot machine! Would you like to play? Enter yeso: yes Generating your three numbers... You spun: 105 2 Oh nol You received -28 points! You now have -20 total pointsl Would you like to play? Enter yeso: bleh df x 4 14 100% , Enter yeso: yes Generating your three numbers. .. You spun: 5 36 oh no! You received -20 points! You now have -50 total points! Would you like to play? Enter yeso: ye:s Generating your three numbers... You spun: 11 9 4 Oh nol You received -20 points! You now have -70 total points! Would you like to play? Enter yeso: no Goodbye! 1. You must properly handle errors in user input. 2. You must use an if chair. 3. You must use a nested if. 4. You must have proper boilerplate 5 You must use while loops

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

What are the different forms of depositary receipt?

Answered: 1 week ago