samedi 16 avril 2022

Im trying to get an if statement to reply to a random number in python and display and print a message

I'm trying to get an if statement to recognize a randomly generated number but I don't know what is going wrong, it just ends the program as soon as i hit start and does not print anything, so far I have this.

import random

random.randint(1,3)

if random.randint == ('1'):
    print('message')

I have tried changing the random.randint(1,3) into a variable by making it "a == ('random.randint(1,3)" but that did not work either. Does anyone know whats going wrong with it?

P.S: Sorry if the question is asked badly, I don't use this site much.




Aucun commentaire:

Enregistrer un commentaire