I'm having trouble setting a list at a certain index to a specified value. For example:
healths[index].split(",")[anotherIndex] = 0
This code runs but doesn't change the value. The reason I'm not just moving this to a list and going through these hoops with indexing a split list is because the first list, "healths" is also a split list. This means the amount of lists within is not a set value, so I could have 1 string in healths or I could have 4 strings in healths. If anyone can help with this it would be much appreciated. Here is another example highlighting what I'm trying to do:
strHealth = "1,8,4,3,/11,12,/"
healths = strHealth.split("/")
ct = int(input("Enter the creature type you're targeting: ")) - 1
cn = int(input("Enter the number of the creature you're targeting: ")) - 1
damage = int(input("Enter the amount of damage dealt: "))
healths[ct].split(",")[cn] = str(int(healths[ct].split(",")[cn]) - damage)
I tried setting the initial healths[ct].split(",")[cn] to an integer but that gave me a "cannot assign to function call here" error. I also double checked on how to change values in a list in python. This has me a bit stumped at the moment.
cn]), but there is no way to see that because the whole list immediately disappears.