I am wondering how to run functions from a list, and calling them using the random module, but I can't seem to get it to work can anyone help? Here is an example below.
import random
def word1():
print "Hello"
def word2():
print "Hello again"
wordFunctList = [word1, word2]
def run():
printWord = random.randint(1, len(wordFunctList))-1
wordFunctList[printWord]
run()
run()
So I wanted to do this in an infinite loop, but all I get for output is
Hello
Hello again
Then the program just doesn't do anything else? Can anyone help me? Btw, I am using the app pythonista. Also I am a programming NOOB. I just recently started with python.
The whole reason I am asking this question is because I am making a text based world generator, and I want to define functions for biomes, then randomly call them from a list while the world is generating.