Skip to main content

#TC1014 #WSQ06 Pick a number

1 min read

Repost for the because the other post is bugged D:

Useful links: 

How to use a while function in python:


Rogel García a01630171

import random

value= random.randint(1,100)


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:"))


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")