Indexing and slicing tuples and lists: Class 11 practice
Indexes start at 0; negative indexes count from the end (−1 is last). Read the method, follow the three worked examples, then try the six questions.
What you should know first
- Sequences
The idea behind indexing and slicing tuples and lists
Indexes start at 0; negative indexes count from the end (−1 is last). A slice t[a:b] includes a but stops before b; t[::k] takes every k-th item.
Step-by-step method
- Write the index under each item (and negative index).
- Apply start:stop:step.
- Remember stop is excluded.
Worked example 1 (Basic)
t = (3, 7, 13, 28, 5, 1, 11, 9). What is t[-2]?
- t[-2] = t[6]
- Answer: 11
Worked example 2 (Standard)
t = (23, 34, 25, 20, 33, 9, 27, 38). What is t[3:8]?
- Items at 3 … 7
- Answer: (20, 33, 9, 27, 38)
Worked example 3 (Challenge)
L = [34, 42, 3, 36, 12, 4, 18, 20]. What is L[1::2]?
- Start at 1, step 2
- Answer: [42, 36, 4, 20]
Common mistakes and misconceptions
- Including the stop index
- Off-by-one with negative indexes
Practice questions
- (Basic) t = (30, 8, 37, 12, 36, 16, 14, 17). What is t[-3]?
- (Basic) t = (32, 30, 9, 16, 13, 49, 30, 44). What is t[-7]?
- (Standard) t = (30, 12, 37, 15, 36, 7, 33, 1). What is t[2:8]?
- (Standard) t = (30, 23, 7, 48, 46, 29, 43, 1). What is t[2:6]?
- (Challenge) L = [15, 39, 22, 31, 47, 14, 43, 15]. What is L[1::2]?
- (Challenge) L = [25, 42, 14, 30, 5, 21, 45, 37]. What is L[3::3]?
Answer key with full working
- Q1: t[-3] = t[5] → Answer: 16
- Q2: t[-7] = t[1] → Answer: 30
- Q3: Items at 2 … 7 → Answer: (37, 15, 36, 7, 33, 1)
- Q4: Items at 2 … 5 → Answer: (7, 48, 46, 29)
- Q5: Start at 1, step 2 → Answer: [39, 31, 14, 15]
- Q6: Start at 3, step 3 → Answer: [30, 45]
Syllabus note
This skill is listed under "Tuples and Lists" for Class 11 in the NCERT/CBSE books. ICSE, IGCSE, IB and state boards may teach it in a different chapter or year.
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Related practice and notes
Frequently asked questions
Which chapter is indexing and slicing tuples and lists in?
"Tuples and Lists", Class 11 Computer Science (NCERT/CBSE). Other boards may place it differently.
How were the answers checked?
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.