Question: PYTHON Stuck on this problem: Write a program for playing a game with the computer. First, generate a random integer in the range of 6

PYTHON

Stuck on this problem:

Write a program for playing a game with the computer. First, generate a random integer in the range of 6 through 9. This will be the computers pick. Then generate three random integers for the human player. These random integers are in the range of 1 through 10. If any of these three random integers is greater than the computers pick, the human player wins the game. Otherwise, the human player loses. You must use a for loop to generate these three random integers. In each iteration, generate and display one random integer. If it is larger than the computers pick, display You have won the game and break out of the loop. If the human player cannot get a random integer larger than computers pick after three iterations , display sorry you have lost the game. The following is an example: Computer's pick: 9 Your pick: 8 Your pick: 3 Your pick: 2 Sorry, you have lost the game Another example: Computer's pick: 6 Your pick: 5 Your pick: 8 You have won the game ***Cannot use "flag" because we have not covered this yet in class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!