I am making this simple code:
MyList=[] valueA=1 valueB=2 valueC=3 MyList.append (valueA) MyList.append (valueB) MyList.append (valueC) print (MyList) print ([My
Your mistake was that you put my_list into another anonymous list at the last line.It should be like this:
MyList=[] valueA=1 valueB=2 valueC=3 MyList.append (valueA) MyList.append (valueB) MyList.append (valueC) print (MyList) print (MyList.index(valueB))
Output:
[1, 2, 3] 1