I have a bit of code that I want to run multiple times. That seams trivial but there is a twist: I want to change the code in a specific way between iterations. For example:
A = 1
B = ['+','-','/'.'*','**']
C = []
for x in range(len(B)):
C.append(A{B[x]}100)
print(C)
Now, I know this code doesn't work and it's not a proper Python syntax, but i't just an example of what I'd like the code to do.
Ideally I'd get C as a list where 0th element is 1 + 100, 1st element is 1 - 100, 2nd element is 1 / 100 etc. (N.b.: NOT '1 + 100' string. A result of 1 + 100 calculation - 101). Basically I want the code to change itself between iterations of loop in a defined way.
I do not want to define some lengthy if
/elif
statement since list B is very, very long.
Edit:
Let me give another example. This one is more relevant to my problem.
A = ['mom','dad','me','you','c']
B = ['a','b','something','nothing','cat']
for x in range(len(A)):
C_{A[x]} = B[x]
I want to end up with 5 new variables so that:
Print(C_mom)
a
Print(C_dad)
b
Print(C_c)
cat
Again, I recognize this is not a proper python syntax and this code doesn't work.