You can use globals() like so:
for e in globals()[name]:
print(e)
Output:
d
e
f
And if your variables happen to be in some local scope you can use locals()
OR you can create your dictionary and access that:
d = {'candy': candy, 'fruit': fruit, 'snack': snack}
name = 'fruit'
for e in d[name]:
print(e)