I am trying to find an element in a list (string) and then print the index. Here is my code:
def checkLen():
days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
position = 0
for i in days:
if i == "Monday":
position = i
print("Found it")
print(position)
But i am getting the result:
Found it
Monday
I have discovered that ,unlike other programming language that i know, Python variable type can change, which is why the Number type "position" changes to a "str", how do i save the index in position?
for i, day in enumerate(days):