In pseudocode, you can create variables such as 'variable(x)', having x as a forever changing number therefore creating multiple different variables. For example, if:
x = 0
variable(x) = 4
x = 1
variable(x) = 7
then printing 'variable(0)' would give you the result '4' and printing 'variable(1)' would output '7'. My question is: is this possible to do in Python?
def variable(x): return {0:4,1:7}[x]?variable? then you could callvariable[0]to get a valuexto different values??variableas a variable, but as a function ofx.