QUESTION IMAGE
Question
what is the next line?
>> tuplea = (5, 20, 30, 40, 30)
>> tuplea.index(30)
0
1
3
2
Step1: Understand tuple index method
The index() method of a tuple in Python returns the index of the first occurrence of the specified element.
Step2: Locate first - occurring 30
In the tuple tupleA=(5, 20, 30, 40, 30), the first 30 is at index 2 (since indexing starts from 0).
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
2