Concept explainers
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
Learn your wayIncludes step-by-step video
Chapter 3 Solutions
Starting Out with Python (4th Edition)
Additional Engineering Textbook Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Mechanics of Materials (10th Edition)
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- 9. Tree Age (Python) Counting the growth rings of a tree is a good way to tell the age of a tree. Each growth ring counts as one year. Use a Canvas widget to draw how the growth rings of a 5-year-old tree might look. Then, using the create_text method, number each growth ring starting from the center and working outward with the age in years associated with that ring.arrow_forwardCard guessing Design a strategy that minimizes the expected number of questions asked in the following game You have a deck of cards that consists of one ace of spades, two deuces of spades, three threes, and on up to nine nines, making 45 cards in all. Someone draws a card from the shuffled deck, which you have to identify by asking questions answerable with yes or no.arrow_forwardcheck_game_over(): as the name suggests, this function should check to see if the game is over (if one side has no stones left in all of its pockets). It takes as an argument the game board and should return True if the game is over and False otherwise.arrow_forward
- Game Description: Pig is a game that has two players (in our case one human and one computer) that alternate turns. Each player’s goal is to get 100 points rolled on a normal six-sided die first. Each turn consists of the rolling the die repeatedly until you get a 1 or decide to stop. As long as you roll a 2-6, you will add this amount to your total for that turn. But if you roll a 1 during your turn, your turn ends and you receive zero points for that entire turn (erasing all of the progress you made since you last agreed to stop). If you decide to stop rolling at any point in your turn, your points for that turn are then added to the overall score. The overall score is then safe from future rolls. The trick is knowing how long to push it before we should stop and save our gains. See end of this document for an example of a game of pig we should write coding as below In order to explore what is the best strategy for the computer player (i.e. at what score do we stop each computer…arrow_forwardMagic 8 Ball Lab Introduction For this lab, you are going to build a simple magic eight-ball, so you no longer have to make any choices. On that note, if you haven’t, you should watch Interstate 60. All joking aside, you will build a 15 sided magic 8-ball, just for simplicity (an actual one has 20 sides for choices). If you are curious about all the choices, you can read up more on them here. Also, if you need a refresher on if statements, go here. Step 1 - Reading the code First take a look at the provided code. You should change the comments to include your name at the top of the file. Furthermore, you will notice all the functions are ‘stubbed’ out for you. This means we have provided the function signature, and a dummy return value that you will replace completely. We have also provided one function in its entirety, so you can use it as a sample/template to look at. def get_positive_answer(answer): ans = "You may rely on it." if answer == 0: ans = "As I see…arrow_forwardMoney Counting Algorithm: Write a program that shows how much the 25 cents, 50 cents and 1 TL coins you put on paper are worth using the size and color information. The algorithm is entirely up to you. Explain the algorithm you developed, add code and images. b) Heads and Tails Detection Algorithm: Write the program that shows whether the coin placed on the paper is heads or tails. Developing the algorithm is entirely up to you. This algorithm should work in three currencies. (If you find a suitable code, etc. somewhere, it is a direct copy. Your codes should be in accordance with the lectures. Put explanations about what you are doing).arrow_forward
- Number of electoral votes: 200Number of popular votes: 300arrow_forwardTests that look inside the box There are a lot of different ways to test a black box.arrow_forwardMoon effect. Some people believe that the Moon controls their activities. If the Moon moves from being directly on the opposite side of Earth from you to being directly overhead, by what percentage does (a) the Moon's gravitational pull on you increase and (b) your weight (as measured on a scale) decrease? Assume that the Earth-Moon (center-to-center) distance is 3.82 x 10° m, Earth's radius is 6.37 x 106 m, Moon's mass is 7.36 x 1022 kg, and Earth's mass is 5.98 x 1024 kg. (a) Number 6.89 Units percent (b) Number i 6.8713e-4 Units percentarrow_forward
- Start myNum RANDOM(1,10) false true myNum > 8 DISPLAY("Done") DISPLAY(myNum) 身arrow_forwardTic-Tac-Toe For this question, you will be implementing a simple Tic-Tac-Toe game without the graphics. Here is how it works: • First, it is randomly determined if the user starts the game or the computer and this information is shown to the user. The player who starts always starts as "X". • The players (computer and the user) will then take turns in playing. The computer will choose a random empty spot on its turn. The user enters its choice in the console. • Each of the empty spots have a corresponding number that the players choose on their turn. If the user enters anything other than the number of an empty spot (not yet filled with "X" or "O"), it will not be accepted, and they will be prompted to enter a correct number. 2 4 7 8 • After each turn, two things need to be done: 1) displaying the updated board 2) checking if anyone has won (it should be printed who has won – the user or the computer). The game goes on until someone wins or until all the 9 empty spots are filled and no…arrow_forwardQ1In manual car gear system, pressing down the clutch pedal allows the driver to change the car’s gears to drive the vehicle on the road with different speed. Following are the dummy details about gear number and their relevant speed limit. 1st Gear 0 – 10 mile per hour (mph) 2nd Gear 10 – 20 mile per hour (mph) 3rd Gear 20 – 60 mile per hour (mph) 4th Gear 60 – 100 mile per hour (mph) Suppose an expert driver is going from Haji Camp Peshawar to Sarhad University Peshawar using the following route drawn as Yellow line with three roundabouts (Red Circles). In manual car gear system, pressing down the clutch pedal allows the driver to change the car’s gears to drive the vehicle on the road with different speed. Following are the dummy details about gear number and their relevant speed limit. 1st Gear 0 – 10 mile per hour (mph) 2nd Gear 10 – 20 mile per hour (mph) 3rd Gear 20 – 60 mile per hour (mph) 4th Gear 60 – 100 mile per hour (mph) Suppose an expert driver is going…arrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage