Starting Out with Python Plus MyLab Programming with Pearson eText -- Access Card Package (4th Edition)
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 3, Problem 9PE

Roulette Wheel Colors

On a roulette wheel, the pockets are numbered from 0 to 36. The colors of the pockets are as follows:

■ Pocket 0 is green.

■ For pockets 1 through 10, the odd-numbered pockets are red and the even-numbered pockets are black.

■ For pockets 11 through 18, the odd-numbered pockets are black and the even-numbered pockets are red.

■ For pockets 19 through 28, the odd-numbered pockets are red and the even-numbered pockets are black.

■ For pockets 29 through 36, the odd-numbered pockets are black and the even-numbered pockets are red.

Write a program that asks the user to enter a pocket number and displays whether the pocket is green, red, or black. The program should display an error message if the user enters a number that is outside the range of 0 through 36.

Blurred answer
05:50
Students have asked these similar questions
Rock Paper Scissors Game Instructions In the game Rock Paper Scissors, two players simultaneously choose one of three options: rock, paper, or scissors. If both chose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows: • Rock beats scissors, because a rock can break a pair of scissors. • Scissors beat paper, because scissors can cut the paper. • Paper beats rock, because a piece of paper can cover a rock. Create a game in which the computer randomly chooses rock, paper, or scissors. Assign the number 1, 2, or 3 to represent one of the three choices. Let the user enter a number. Then determine the winner by comparing the user input and the randomly generated choice of the computer. Additional instructions: • The Program should validate all user input. • Game should ask the user to play again and continue if yes and stop if no. • Once the user stops playing, program should print the total number of wins.
Monty Hall Problem – Coding Lab In this lab, you will write a code that simulates the Monty Hall Game Show. Thegame host gives the participant the choice of selecting one of three doors. Twodoors has a goat behind them and one door has a prize. The set of choices arerandomized each round. The participant needs to select the door with the prizebehind it. When the participant selects a door, the game host reveals a door with agoat behind it. The game host opens a door (different from the one selected by theparticipant) that has a goat behind it. The participant is then given the option tochange their choice. When you run your code, the code would display a message prompting the user toinput their door choice, labelled as 1, 2, and 3. Then the code will display a doornumber (different from the one the user picked) with a goat behind it and ask theuser if they would like to change their choice. The code then displays a message onwhether the user guessed the correct door. The game then…
Dice game Rules of the game: The players roll three dice, and the program adds the sides that turn up. After the first roll of the three dice, a player may choose to roll the dice as many times as they wish until the player gets at least one side 2 from a dice. When a player gets at least one side 2 from the dice, that player's score drops to zero, and the turn switches to the other player. Both players play the game for an equal number of turns, and the player who gets a score higher than 18 wins. If both players get a score higher than 18 within an equal number of turns, the player with the higher score wins. If both of the players got the same scores, print the scores of the players. These are the minimum required functions for this program. Design and implement these functions. You can create more functions if you choose to. Here is the provided starter code: # A program to play a Dice game. import random def roll_die(): ''' Simulate a die roll ''' def…

Chapter 3 Solutions

Starting Out with Python Plus MyLab Programming with Pearson eText -- Access Card Package (4th Edition)

Ch. 3.3 - What would the following code display? If 'z a:...Ch. 3.3 - What would the following code display? s1 = 'New...Ch. 3.4 - Convert the following code to an if-elif-else...Ch. 3.5 - Prob. 14CPCh. 3.5 - Prob. 15CPCh. 3.5 - Assume the variables a = 2, b = 4, and c = 6....Ch. 3.5 - Explain how short-circuit evaluation works with...Ch. 3.5 - Write an if statement that displays the message...Ch. 3.5 - Write an if statement that displays the message...Ch. 3.6 - Prob. 20CPCh. 3.6 - What is a flag variable?Ch. 3.7 - Prob. 22CPCh. 3.7 - Prob. 23CPCh. 3.7 - Prob. 24CPCh. 3.7 - Prob. 25CPCh. 3.7 - How do you determine the turtle's pen color? How...Ch. 3.7 - Prob. 27CPCh. 3.7 - Prob. 28CPCh. 3 - A ______ structure can execute a set of statements...Ch. 3 - A __________ structure provides one alternative...Ch. 3 - A(n) _________ expression has a value of either...Ch. 3 - The symbols , , and == are all ___________...Ch. 3 - A(n)__________ structure tests a condition and...Ch. 3 - You use a(n) _______ statement to write a single...Ch. 3 - You use a(n) ______ statement to write a dual...Ch. 3 - and, or, and not are ________ operators. a....Ch. 3 - A compound Boolean expression created with the...Ch. 3 - A compound Boolean expression created with the...Ch. 3 - The _________ operator takes a Boolean expression...Ch. 3 - A ________ is a Boolean variable that signals when...Ch. 3 - Prob. 1TFCh. 3 - A program can be made of only one type of control...Ch. 3 - A single alternative decision structure tests a...Ch. 3 - A decision structure can be nested inside another...Ch. 3 - A compound Boolean expression created with the and...Ch. 3 - Explain what is meant by the term conditionally...Ch. 3 - You need to test a condition then execute one set...Ch. 3 - Briefly describe how the and operator works.Ch. 3 - Briefly describe how the or operator works.Ch. 3 - Prob. 5SACh. 3 - What is a flag and how does it work?Ch. 3 - Write an if statement that assigns 20 to the...Ch. 3 - Write an if statement that assigns 0 to the...Ch. 3 - Write an if-else statement that assigns 0 to the...Ch. 3 - The following code contains several nested if-else...Ch. 3 - Write nested decision structures that perform the...Ch. 3 - Write an if-else statement that displays 'speed is...Ch. 3 - Write an if-else statement that determines whether...Ch. 3 - Prob. 8AWCh. 3 - Prob. 9AWCh. 3 - Prob. 10AWCh. 3 - Day of the Week Write a program that asks the user...Ch. 3 - Areas of Rectangles The area of a rectangle is the...Ch. 3 - Age Classifier Write a program that asks the user...Ch. 3 - Roman Numerals Write a program that prompts the...Ch. 3 - Mass and Weight Scientists measure an objects mass...Ch. 3 - Magic Dates The date June 10, 1960, is special...Ch. 3 - Color Mixer The colors red, blue, and yellow are...Ch. 3 - Hot Dog Cookout Calculator Assume hot dogs come in...Ch. 3 - Roulette Wheel Colors On a roulette wheel, the...Ch. 3 - Money Counting Game Create a change-counting game...Ch. 3 - Book Club Points Serendipity Booksellers has a...Ch. 3 - Software Sales A software company sells a package...Ch. 3 - Shipping Charges The Fast Freight Shipping Company...Ch. 3 - Body Mass Index Write a program that calculates...Ch. 3 - Time Calculator Write a program that asks the user...Ch. 3 - February Days The month of February normally has...Ch. 3 - Wi-Fi Diagnostic Tree Figure 3-19 shows a...Ch. 3 - Restaurant Selector You have a group of friends...Ch. 3 - Turtle Graphics: Hit the Target Modification...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Average Rainfall Design a program that uses nested loops to collect data and calculate the average rainfall ove...

Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)

The ________ object is assumed to exist and it is not necessary to include it as an object when referring to it...

Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)

How do you create a button with a text and a node? Can you apply all the methods for Labeled to Button?

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

How many "hello' output lines does this program print?

Computer Systems: A Programmer's Perspective (3rd Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Python Tutorial #10; Math Functions in Python; Author: Art of Engineer;https://www.youtube.com/watch?v=OviXsGf4qmY;License: Standard YouTube License, CC-BY