Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
+1 vote
5.9k views
in Computer by (30 points)
Given the list l =[2,5,4,9,10,11,20] write the output print (L[2:6]

Please log in or register to answer this question.

1 Answer

0 votes
by (1.4k points)
edited by

print (L[2:6]) means print all the values in list from index value 2 to 6

Since, index starts from 0, so the value at index 2 is 4 and at index 6 is 20.

But the item at position 6 will not be included.

Therefore output will be [4,9,10,11].

Note: The search will start at index 2 (included) and end at index 6 (not included).

Remember that the first item has index 0.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...