Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

number=[1,2,3,4,5,6,7,8,9,1] print(number.index(1,1)) answer =9 how??

0 votes
asked Oct 10, 2019 by Ehtisham Farrukh

2 Answers

0 votes
answered Oct 12, 2019 by kabir singh
This is because index() having 3 arguments

element , start(opt), end(opt)

In your example :


means position of 1 , start searching from the first position.

therefore answer is 9 position.
0 votes
answered Nov 7, 2019 by dheeraj (1,090 points)
yes,it is printing '9' because 'index' command used for finding the position in the list


it contain 3 arguments
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.