I am having a bit of trouble changing the values of list elements when utilizing a for loop. The following code outputs 10 and 5 - but I'm expecting 10 and 10.
amount = 5
costFieldList = [amount]
for index, field in enumerate(costFieldList):
if type(field) is int:
costFieldList[index] = field*2
print(costFieldList[index])
print(amount)
Is this an issue of scope? Thanks in advance.
print(costFieldList)instead.type(field) is intuseisinstance(field, int)