subject

Python question: write a program that generates a random number in the range of 1 through 100, and asks the user to guess what the number is. if the user’s guess is higher that the random number the program should display "too high try again." if the user’s guess is lower than the random number, the program should display "too low, try again" if the user guesses the number the application should congratulate the user and then generate a new random number so the game can start over.

this is what i have so far..

#generates and imports a random number between 1-100
import random
number=random. randint(1,100)

#sets main function
def main():
print("this is a number guessing game.")
print("guess what number we thought of between 1 and 100")
#print statement

num = number()
#stores number of user guesses
user = 0
#stores number of guesses
guesses = 0
#while statement
while user ! = num:

user=int(input("enter your best guess! "))

guesses=guesses +1

if (user > num):
print ("too high, try again")
else:
print("congrats, you won! ")
print("restarting game")

main()

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 08:00
How can smart devices benefit businesses, organizations, and social communities in the global marketplace?
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Why should you evaluate trends when thinking about a career path?
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
George is working as a programming team lead. which statements correctly describe the skills that he requires?
Answers: 3
question
Computers and Technology, 24.06.2019 18:30
What is the local portion of the e-mail address below? [email protected] a.) @ b.) biz c.) gumchewer d.) twrigley
Answers: 1
You know the right answer?
Python question: write a program that generates a random number in the range of 1 through 100, and...
Questions
Questions on the website: 13722360