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 (3rd Edition)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Starting out with Visual C# (4th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Modern Database Management
Computer Systems: A Programmer's Perspective (3rd Edition)
- Card 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_forwardGame 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_forward
- Money 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_forwardNumber of electoral votes: 200Number of popular votes: 300arrow_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
- X =5 ; a = -3; b = 2arrow_forwardQ2 The Powerball Lottery 15 Points The Powerball lottery is based on a random drawing of six balls from two machines. One machine contains 69 white balls (labeled 1 through 69) and the other machine contains 26 red balls (labeled 1 through 26). To determine the winning numbers, the gamemaster draws five white balls from the first machine and one red ball (the "Powerball") from the second machine (assume all outcomes are equally likely). A player in the Powerball lottery picks five different numbers between 1 and 69 (inclusive) and a sixth number between 1 and 26 (inclusive), which may duplicate one of the first five numbers. For each of the following questions, you should write your answer as an expression. Do not give the final numeric value. For example, you should write C(4, 2)/24) instead of 0.375.arrow_forwardChallenge Activity 1: Turtle Graphics (PYTHON): Hit the Target Modification Enhance the hit_the_target game program shown in the computer lab activity above, so that, when the projectile misses the target, it displays hints to the user indicating whether the angle and/or the force value should be increased or decreased. For example, the program should display messages such as 'Try a greater angle' and 'Use less force.'arrow_forward
- Fat Percentage Calculator One gram of fat has 9 calories. If you know the number of fat grams in a particular food, you can use the following formula to calculate the number of calories that come from fat in that food: Calories from fat = Fat grams × 9 If you know the food’s total calories, you can use the following formula to calculate the percentage of calories from fat: Percentage of calories from fat = Calories from fat ÷ Total calories Create an application that allows the user to enter: • The total number of calories for a food item • The number of fat grams in that food item The application should calculate and display: • The number of calories from fat • The percentage of calories that come from fat Also, the application’s form should have a CheckBox that the user can check if he or she wants to know whether the food is considered low fat. (If the calories from fat are less than 30% of the total calories of the food, the food is considered low fat.) Use the following test data…arrow_forwardCorrect answer will be upvoted else downvoted. Computer science. After painting the white cells of the board, you want to place the maximum number of dominoes on it, according to the following rules: each domino covers two adjacent cells; each cell is covered by at most one domino; if a domino is placed horizontally (it covers two adjacent cells in one of the rows), it should cover only red cells; if a domino is placed vertically (it covers two adjacent cells in one of the columns), it should cover only blue cells. Let the value of the board be the maximum number of dominoes you can place. Calculate the sum of values of the board over all 2w possible ways to paint it. Since it can be huge, print it modulo 998244353. Input The first line contains two integers n and m (1≤n,m≤3⋅105; nm≤3⋅105) — the number of rows and columns, respectively. Then n lines follow, each line contains a string of m characters. The j-th character in the i-th string is * if the j-th cell in the i-th row…arrow_forwardVisual Basic For tax purposes an item may be depreciated over a period of several years, n.With the straight line method of depreciation, each year the item depreciates by 1/nth of itsoriginal value. With the double declining balance method of depreciation, each year the itemdepreciates by 2/nths of its value at the beginning of that year. (In the final year it is depreciatedby its value at the beginning of the year.)Write a program that performs the following tasks:1.1 Request a depreciation of the item, the year of purchase, the cost of the item, the number ofyears to be depreciated (estimated life), and the method of depreciation. The method ofdepreciation should be chosen by clicking on one of two buttons.1.2 Display a year by year description of the depreciation.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning