I have 2 tuples (I think that’s what they are):
fs = 90,30,50,180,90,90,24,90,90 dr = 8,7,6,5,4,3,2,1,0 for num in dr: if num == 0: dr = fs for num in fs: fs = (fs)-1 else: pass print("dr =", dr) print() print("fs =", fs)
when iterating through dr, if it finds a ‘0’, then I need to change ‘0’ to the corresponding number index of fs, then subtract 1 from the indexed fs item. (I hope my explanation in clear enough.
This is the last stage of a larger script that works well as is
I think I could do it if they were both lists. ie. # fs = [90,30,50,180,90,90,24,90,90]
# dr = [ 8,7,6,5,4,3,2,1,0 ]
when I try to execute code as is I get the following error:
Traceback (most recent call last):
File “test.py”, line 9, in
dr = fs
TypeError: ‘tuple’ object does not support item assignment
not sure at this point how to achieve desired result without altering previous code.
Any help is greatly appreciated.
Thanks in advance
python 3.6 user