2) 3) Write a program named Guess_A_Number that plays a game in which the program picks a...
Fantastic news! We've Found the answer you've been seeking!
Question:
2)
3)
Transcribed Image Text:
Write a program named Guess_A_Number that plays a game in which the program picks a secret number and the user tries to guess it. 1) The program first asks the user to enter the maximum value for the secret number. 2) Next, it chooses a random number that is >= 1 and<= the maximum number. 3) Then the user must try to guess the number. 4) When the user succeeds, the program asks the user whether or not to play another game. The following example shows what the user will see on the screen (user input is in bold): 2. Input and output Guess the secret number. Enter maximum value for secret number: 10 A new secret number has been chosen. Enter guess: 3 Too low; try again. Enter guess: 8 Too low; try again. Enter guess: 9 Too low; try again. Enter guess: 10 You won in 4 guesses! Play again? (Y/N) y Write a program named Guess_A_Number that plays a game in which the program picks a secret number and the user tries to guess it. 1) The program first asks the user to enter the maximum value for the secret number. 2) Next, it chooses a random number that is >= 1 and<= the maximum number. 3) Then the user must try to guess the number. 4) When the user succeeds, the program asks the user whether or not to play another game. The following example shows what the user will see on the screen (user input is in bold): 2. Input and output Guess the secret number. Enter maximum value for secret number: 10 A new secret number has been chosen. Enter guess: 3 Too low; try again. Enter guess: 8 Too low; try again. Enter guess: 9 Too low; try again. Enter guess: 10 You won in 4 guesses! Play again? (Y/N) y
Expert Answer:
Related Book For
Stats Data and Models
ISBN: 978-0321986498
4th edition
Authors: Richard D. De Veaux, Paul D. Velleman, David E. Bock
Posted Date:
Students also viewed these programming questions
-
the array is : X = [1 2 3 4 5 6 7 8 ; 8 7 6 5 4 3 2 1 ; 3 2 -5 0 5 0 0 0 ; 1 4 9 4 -4 6 0 1 ; 3 2 1 4 8 -2 7 3 ; 1 2 1 2 1 2 1 2 ; 6 2 -4 5 -4 6 3 8];
-
2 (5x + 3) 2x < 3 (2x 4) + 2 Describe the solution set as an inequality, in interval notation, and on a graph.
-
What is the coefficient of O2 ? 5 O 10 11 O 4 FeS2 + 02 --> - Fe2O3 + SO2 -
-
DS Unlimited has the following transactions during August. August 6 Purchases 88 handheld game devices on account from GameGirl, Inc., for $290 each, terms 1/10, n/60. August 7 Pays $490 to Sure...
-
Use mesh analysis to find current io in the circuit of Fig. 10.74. 2 k2 to 0.4H 20 sin 103 V 10 cos 103t v (+
-
Youve explained replication to management, and some managers ask you for examples of when replication could be useful to them. Describe two situations, other than the ones given in the text, when...
-
What are some of the best practices to manage information security and privacy in terms of procedural, technical, and physical controls?
-
1. Do you agree that the entrepreneurs company is not sellable? 2. Are there any other options for the entrepreneur besides selling his business? 3. What would you recommend the entrepreneur do? Why?
-
Tiago makes three models of camera lens. Its product mix and contribution margin per unit follow: Lens A Lens B Lens C Required: Percentage of Unit Sales 30% 37 33 Contribution Margin per Unit $ 45...
-
At the beginning of Year 2, the Redd Company had the following balances in its accounts: Cash ..................................................................$16,900 Inventory...
-
Discuss in brief that if someone is cyber bullied because of their race this should be considered a hate crime?Why or why not.Give an example
-
A fielder tosses a 0.15 kg baseball at 32 m/s at a 30 angle to the horizontal. What is the balls kinetic energy at the start of its motion? What is the kinetic energy at the highest point of its arc?
-
On a chilly 10C day, you quickly take a deep breathall your lungs can hold, 4.0 L. The air warms to your body temperature of 37C. If the air starts at a pressure of 1.0 atm, and you hold the volume...
-
When the hoof of a galloping horse hits the ground, the digital flexor tendon in its lower leg may stretch by 5% in length, a significant stretch for this 45 cm tendon. The tendon is elastic; mostbut...
-
A 500 kg horse can provide a steady output power of 750 W (that is, 1 horsepower) when pulling a load. How about a 38 kg sled dog? Data show that a 38 kg dog can pull a sled that requires a pulling...
-
When people exercise, they report feeling exhaustion when their body temperature rises to 39.7C. A 68 kg man is running at 15 km/h on a hot, muggy dayso hot and muggy that he cant lose any heat to...
-
1. The following stream is at 100 F and 20 psia is to be separated into the four indicated products. Determine the best two distillation sequences by the heuristics and compare the result of modeling...
-
On October 31 Juanita Ortega, owner of Outback Guide Service, received a bank statement dated October 30. Juanita found the following: 1. The checkbook has a balance of $2,551.34. 2. The bank...
-
You play two games against the same opponent. The probability you win the first game is 0.4. If you win the first game, the probability you also win the second is 0.2. If you lose the first game, the...
-
A sample is chosen randomly from a population that was strongly skewed to the left. a) Describe the sampling distribution model for the sample mean if the sample size is small. b) If we make the...
-
What about drawing a random sample only from cell phone exchanges? Discuss the advantages and disadvantages of such a sampling method compared with surveying randomly generated telephone numbers from...
-
The probabilities that a TV station will receive \(0,1,2,3, \ldots, 8\) or at least 9 complaints after showing a controversial program are, respectively,...
-
A rotary plug valve needs to be replaced to repair a machine, and the probabilities that the replacement will be a flange style (low pressure), flange style (high pressure), wafer style, or lug style...
-
If each point of the sample space of Figure 3.12 represents an outcome having the probability find, 32
Study smarter with the SolutionInn App