Post

Rakesh Das
Rakesh Das@RakeshDas_18·
@Python_Dv A. 2 is the output. Because the index() method returns the index of the first occurrence of the specified value. In this case, the value 3 is at index 2 (0-based indexing) in the list list_x.
English
0
0
0
637
Pradip Thapa🇳🇵
Pradip Thapa🇳🇵@thepradipthapa·
@Python_Dv The following code prints the index of the element '3' in the list 'list_x'. Since the element '3' is at index '2' in the list, it will print 2.
English
0
0
0
532
Prem Prakash
Prem Prakash@4EverPrem·
@Python_Dv 2. index will return the first index of the value. 3 is at index 2 so it prints 2
English
0
0
0
257
Dood_057
Dood_057@edgarcia53·
@Python_Dv A) 2 index(3), Result is the index of number 3 in the array.
English
0
0
0
319
Mardernasenhaar 🦓
Mardernasenhaar 🦓@mardernasenhaar·
@Python_Dv To understand the index function try this with a string: word = 'Quarterpounder' result = word.index('p') print(result) 7 Note: index() returns index of first occurence of element searched in string or list and terminates. Try 'e'. 5 result = word.index('e', 6) 12
English
0
0
0
58
Data Wizard
Data Wizard@DataWizardPhd·
@Python_Dv Answer is A as the the number 3 is found in position 2. What happens if you change the list to look like this? list_x = [1, 2, 3, 4, 3] Would this change the answer? Why or why not?
English
0
0
0
91
Paylaş