Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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:
expand button
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
expand button
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
Check Mark
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

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