I'm searching a way to convert only one element from a list that contain a string and a tuple.
My function returns a list that contains a string and a tuple like that : "['X', ([0], [3])]"
def return_case():
...
case = 1
return [case, coords_case]
And the goal is that another fonction takes the case[1][0] as an int.
Any ideas?
CodePudding user response:
You could have the function take case[1][0]
and turn it into an int via case[1][0][0]
For example:
case = ['X', ([25], [3])]
def f(x):
print(x*x)
f(case[1][0][0])
outputs 625