Repost for the #WSQ06 because the other post is bugged D:
Useful links: http:/
How to use a while function in python: http:/
Code:
#Gilberto Rogel García a01630171
import random
value= random.randint(1,100)
tries=0
num= int(input(“Guess a number from 1 to 100:”))
while num != value:
if num>value :
print (num, “is too high”)
num= int(input(“Try again:”))
tries=tries+1
elif num<value :
print (num, “is too low”)
num= int(input(“Try again:”))
tries= tries+1
tries= tries +1
print(“Congratulations!, The right number is”,value)
print(“It took you” ,tries, “tries to win”)
#TC1014 #WSQ06 Pick a number by Gilberto Rogel García is licensed under a Creative Commons Attribution 4.0 International License.