1. the program must limit the number of incorrect guesses to seven (7), at seven incorrect guesses the player losses 2. the program must keep track of computer and player wins/losses and display those totals when the program closes 3. the program must continue to run until told to stop by the player

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

The following instructions are below. Also below, is what I have so far. The rest I couldn't figure out.

import random
#Input
number = random.randint(1, 100)
print("I'm thinking of a number between 1 and 100.")
guess Taken = 0
#Process
while guessTaken < 7:
guess=input("Enter a guess: ")
guess = int(guess)
guessTaken = guess Taken + 1
if guess < number:
print("That was too low.")
elif guess > number:
print("That was too high.")
else:
#Output
break
if guessTaken == number:
print("Congrats. You've guessed the right number!")
print("Game over. You lose.")
else:
Transcribed Image Text:import random #Input number = random.randint(1, 100) print("I'm thinking of a number between 1 and 100.") guess Taken = 0 #Process while guessTaken < 7: guess=input("Enter a guess: ") guess = int(guess) guessTaken = guess Taken + 1 if guess < number: print("That was too low.") elif guess > number: print("That was too high.") else: #Output break if guessTaken == number: print("Congrats. You've guessed the right number!") print("Game over. You lose.") else:
Random number guessing game
Design and write a modular python program from chapter 5, exercise 20 in your textbook, with the
Following modifications:
1. the program must limit the number of incorrect guesses to seven (7), at seven incorrect
guesses the player losses
2. the program must keep track of computer and player wins/losses and display those totals
when the program closes
3. the program must continue to run until told to stop by the player
Transcribed Image Text:Random number guessing game Design and write a modular python program from chapter 5, exercise 20 in your textbook, with the Following modifications: 1. the program must limit the number of incorrect guesses to seven (7), at seven incorrect guesses the player losses 2. the program must keep track of computer and player wins/losses and display those totals when the program closes 3. the program must continue to run until told to stop by the player
Expert Solution
Step 1

Steps to do-

First make variable that continue the program 1

use while loop and in condition check whether it is 1

Now use nested while loop as while loop given in your program

Now in output comment make total guess 0

ask user to continue or exit program

if user choose to exit

then display total win, loss

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education