- Executors
-
Learn
Learn Python Runnable examples, NumPy, pandas, and more Learn AI / Machine LearningNeural networks, ML and LLMs from scratch Learn C & C++ Pointers, memory, STL, and modern C++ Learn C#C# basics, OOP, LINQ, async, and .NET exercises Learn MatplotlibLine, bar, scatter and pie charts with live visualizers Learn RustOwnership, traits, error handling, and threads Learn GoSlices, interfaces, goroutines, and channels Python Algorithms Search, sorting, recursion, and visualizers O(n) C & C++ Algorithms Compare algorithms implemented in C and C++ Coding for Kids Learn to code by playing!
- QuizzesNew
- ChallengesNew
- For TeachersNew
- Updates
- Buy me a coffee
Python enumerate, zip and sorted Quiz
This Python quiz checks how well you know enumerate(), zip() and sorted(), the built-ins that make loops shorter and clearer. You will predict output, pick the idiomatic loop and spot the difference between sorted() and list.sort().
Sample question
Question 1 of 10What does this print?
print(list(enumerate("abc", start=1)))
Show the answer
B. [(1, 'a'), (2, 'b'), (3, 'c')] enumerate() yields (index, item) pairs, index first. start=1 only changes where counting begins, so the first pair is (1, 'a').
What this quiz covers
- Counting with
enumerate()and itsstartargument - Pairing lists with
zip()and what happens when lengths differ sorted()vslist.sort()- Sorting with
key=andreverse=True - Unzipping pairs with
zip(*pairs)
Questions people ask
Do I need an account?
No. Anyone can play. Sign in to keep your XP, streak, badges and history.
Which Python version?
Python 3.12. Every question about output was checked by running the code.
Can I retake it?
Yes. Your best score is kept, and the questions and answers are shuffled each time.