Im trying to create a function that takes a list and assigns each of the strings in the list to a variable even when you dont know how many strings are in the list
Here is something i tried:
ExampleList = ['turtle','cow','goat','pig','swag']
def add_One(list):
x = "a"+"1"
y = 0
y = y+1
x = list[y]
while True:
add_One(ExampleList)
so basically im taking the example list then im using a1
to define ExampleList[1]
then i want it to loop and assign a11
to ExampleList[2]
and so on
for an output im trying to get:
a1 = ExampleList[1]
a11 = ExampleList[2]
a111 = ExampleList[3]
a1111 = ExampleList[4]
and so on
i know this isnt the right way to do it but im trying to show you guys what i was trying to do
If anyone knows how to do this correctly please help!