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, 22.06.2019 14:00
What are procedures that keep a data base current
Answers: 1
question
Computers and Technology, 22.06.2019 22:10
Asequential circuit contains a register of four flip-flops. initially a binary number n (0000 ≤ n ≤ 1100) is stored in the flip-flops. after a single clock pulse is applied to the circuit, the register should contain n + 0011. in other words, the function of the sequential circuit is to add 3 to the contents of a 4-bit register. design and implement this circuit using j-k flip-flops.
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
question
Computers and Technology, 23.06.2019 16:00
An english teacher would like to divide 8 boys and 10 girls into groups, each with the same combination of boys and girls and nobody left out. what is the greatest number of groups that can be formed?
Answers: 2
You know the right answer?
Python question: write a program that generates a random number in the range of 1 through 100, and...
Questions