August 2021
Beginner to intermediate
118 pages
1h 29m
English
| Puzzle 8 | sorted? reversed? |
| | nums = [4, 1, 3, 2] |
| | rev = reversed(nums) |
| | print(sorted(rev) == sorted(rev)) |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: False
The built-in reversed function returns an iterator.
Python’s iterators can do two things:
Read now
Unlock full access