samedi 3 janvier 2015

Python Random Module

Anyone have any good idea how to approach this. I'm trying to figure out if you can use the random module to create randomized outcomes. For instance you create a range of 1, 3 where those numbers equal different functions that are triggered when the number is chosen in the background. Here's the code I'm trying. I know it doesn't work but I'm still trying out different ideas but would love some help.



import random

random.choice('1 2')

if random.choice == "1":
print("Hello")

if random.choice == "2":
print("Goodbye")




Aucun commentaire:

Enregistrer un commentaire