Ethan Bierlein
Ethan Bierlein

Reputation: 3535

Some issue with random.choice and variables?

I have a program that prints ou random things from a function, but it isn't exactly working right. All the program does is give blank output and nothing else. Here is an example of the program:

def funct1():
    print "Funct1"

def funct2():
    print "Funct2"

functs = [funct1, funct2]

def run():
    select_funct = random.choice(functs)

run()

Like I said, whenever I run this script, it just gives empty output. Can anyone help?

Upvotes: 0

Views: 43

Answers (1)

mtadd
mtadd

Reputation: 2555

You much invoke your function reference from run.

def run():
   select_funct = random.choice(functs)
   select_funct()

Upvotes: 2

Related Questions