i'm pretty new to python and i'm having trouble with passing an argument into the random.choice function.
basically i'm trying to write a loop that will start off by selecting a random letter(which are all names of other lists) from the 'a' list, then input the selected letter into random.choice again to generate a sequence of random letters.
unfortunately the second call to random.choice isn't working, it just keeps repeating the inputted letter instead of pointing to a new list. any ideas how to fix this? i've been looking online for a few hours but can't find any similar problems/solutions. any help would be much appreciated!
import random
a = ['b','c','d']
b = ['a','e']
c = ['a','d','f']
d = ['a','c','e','f','g','h']
e = ['b','d','h']
f = ['c','d','g','i']
g = ['d','f','i']
h = ['d','e','g','i']
i = ['f','h']
x = 0
answer = random.choice(f)
print "answer is %s " % answer
while x < 5:
answer2 = random.choice(answer)
print "answer2 is now %s " % answer2
x = x + 1