Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Guess my number. Write a robust program that randomly selects a number 1through 100 and asks the user to guess the number. At each guess

Guess my number. Write a robust program that randomly selects a number 1through 100 and asks the user to guess the number. At each guess the user should be told if the guess is proper, and if so, whether it is too high or too low. The user should be told of the number of guesses when finally guessing the correct number. Please complete in notepad++ then save in .py Complete your program design(flow chart, Pseudocode,or other). Save the finished project as a .pyfile import random ran_num = random.randint(1,101) print(ran_num) user_guess = int(input("Enter a number between 1 and 100 : ")) guess_count = 1 while user_guess != ran_num: if user_guess > ran_num: print("user guess is too high ") if user_guess < ran_num: print("user guess is too low") guess_count += 1 user_guess = int(input("Again enter a number between 1 and 100 :")) print("total no of guess count",guess_count) This program will not run properly. Keeps giving and error message=expected an indented block import random ran_num = random.randint(1,101) print(ran_num) user_guess = int(input("Enter a number between 1 and 100 : ")) guess_count = 1 while user_guess != ran_num: if user_guess > ran_num: print("user guess is too high ") if user_guess < ran_num: print("user guess is too low") guess_count += 1 user_guess = int(input("Again enter a number between 1 and 100 :")) print("total no of guess count",guess_count) Even after putting proper spacing it is still not running properly. I am eager to getting it running asap.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago