0

Can someone help me with this code?

#this is a guessing game...the computer has a number it guesses and wants you to tell. import random #we imported random numbers Rng= random.Random() number= rng.randrange(1,100) #Get random number (1 and 100) guesses= 0 Message= " " While true: guess= int(input(Message + "\nGuess my number between 1 and 100:")) guesses += 1 If guess> number : Message += str(guess) + "is too high.\n" elif guess< number : Message += str(guess) + "is too low.\n" else : input("\n\nGreat,you got it in" str(guesses) + "guess!\n\n")

23rd Nov 2019, 10:35 PM
Chukwuma Daniel Chibuike
Chukwuma Daniel Chibuike - avatar
1 Resposta
0
change this part: rng = random.Random() number = rng.randrange(1, 100) (although.... not sure why you doing it that way. just do... random.range(1, 100) change: while True: # lowercase "w" and uppercase "T". "break" at the end.
23rd Nov 2019, 11:01 PM
rodwynnejones
rodwynnejones - avatar