mercredi 20 novembre 2019

Random Number Generator from 0 to 20 and User inputs a number that can be true or false

So basically I made a Python code that gives a random number between 0 and 20. When I run it, it makes the guessed number false while the guessed number is true. I tried to make only one answer true by telling it is 14, which must be true. But I made a mistake. It is the second time i used input so please do not tell me stupid please. Thanks for helping <3

from random import *

def main():
    question = input("Guess a number between 0 and 20 \n")
    randomInt = randrange(14, 15)

    if randomInt == question:
        print("You are right! It is " + str(randomInt))
    else:
        print("Wrong the number is " + str(randomInt))

if __name__ == '__main__':
    main() ```




Aucun commentaire:

Enregistrer un commentaire