a= ["Ga", "Ga", "Ga", "Na"] for i in a : print(a.index(i))
The output value is 0 0 0 3 It's an index
0 1 2 3 How can I change it to
list
a= ["Ga", "Ga", "Ga", "Na"]
for k, v in enumerate(a):
print(k, v)
where k is the index v is the value.
© 2024 OneMinuteCode. All rights reserved.