Great approach (due to some simplification in your skeleton code). Since you are requesting an example:
import random
def main():
def process(data):
return data + [0]
def process1(data):
return data + [9]
def process2(data):
return data + [7]
def run(data):
test = random.choice([process,process1,process2])
print test(data)
for i in range(7):
run([1, 2, 3])
main()
I did this 7 times to show that each choice is really random, i.e. a typical output might look something like this:
[1, 2, 3, 7]
[1, 2, 3, 0]
[1, 2, 3, 0]
[1, 2, 3, 7]
[1, 2, 3, 0]
[1, 2, 3, 9]
[1, 2, 3, 9]
(changing randomly each time, of course, -).
source
share