I have these lists:
sqvaluelist = []
valuelist = [(10.5,), (20.5,), (21.5,), (70.0,), (34.5,)]
I want to apply this code on the valuelist:
for value in valuelist:
valuesquared = value*value
sqvaluelist.append(valuesquared,)
but I received this error:
TypeError: can't multiply sequence by non-int of type 'tuple'
I think I know the reason behind this error, it is because every value is inside a separate tuple.
My question is, is there any way to take this values off their respective tuple, and just turn them into a list like
valuelist = [10.5, 20.5, 21.5, 70.0, 34.5]
without manually editing the structure of the existing list so that the for loop can be executed?
EDIT: I apologize! They are actually tuples! Added commas after each value. Sorry!