samedi 28 août 2021

Small glitch in finding number game

So I am making this small project where it picks a random number from 1 to 100 and it keeps printing it till it sees 20 in it and stops it. Though I am getting the random numbers it does not do anything when it prints out 20. Maybe this is me being dumb but it would be appreciated if someone could help me. Thanks!

The script:

import random

while True:
    n = random.randrange(1,101)
    print(n)


if n == 20:
    print("That is the number we are looking for")
    break



Aucun commentaire:

Enregistrer un commentaire