Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.
Fun, engaging games to boost memory, math fluency, typing speed, and English skills—perfect for learners of all ages.
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Test your understanding with targeted questions related to the topic.
Question 1
Easy
What is the output of fruits[0:2]
for the list fruits = ['apple', 'banana', 'mango', 'orange']
?
💡 Hint: Look closely at the starting and ending indices.
Question 2
Easy
If fruits = ['apple', 'banana', 'mango', 'orange']
, what does fruits[:2]
return?
💡 Hint: Remember ':' means from the beginning up to the index specified.
Practice 4 more questions and get performance evaluation
Engage in quick quizzes to reinforce what you've learned and check your comprehension.
Question 1
What will fruits[0:3]
return for the list fruits = ['apple', 'banana', 'mango', 'orange']
?
💡 Hint: Think about the inclusive start and exclusive end of the range.
Question 2
If fruits[1:]
is executed, what will it return?
💡 Hint: What does omitting the end index signify?
Solve 2 more questions and get performance evaluation
Push your limits with challenges.
Question 1
You have a list of cities: cities = ['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix']
. Write a code snippet that uses slicing to return ['Chicago', 'Houston', 'Phoenix']
.
💡 Hint: Think about how to access the elements starting from the index of 'Chicago'.
Question 2
Given colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
, create a new list with just the warm colors: ['red', 'orange', 'yellow']
. How would you slice for this?
💡 Hint: Identify the starting point and how many colors fall under 'warm'.
Challenge and get performance evaluation