+ 1

What happens when letters repeat in python list and then use index to find its occurrence??

I had a simple question that if I create a list as follows: letters=["s","d","h","g","h","k","j","h"] and then use index to count the occurrence of each letter. As you can see the letter 'h' has been repeated thrice. So in this case what would be the output??

26th Aug 2017, 5:41 PM
Adithya
Adithya - avatar
1 Odpowiedź
+ 2
I tried out this program in python shell and the output showed that it counted the first occurrence of letter 'h'
26th Aug 2017, 5:44 PM
Adithya
Adithya - avatar