

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Recursion
incomplete
2: Recursion Review
incomplete
3: Zipmap
incomplete
4: Recursion Quiz
incomplete
5: Nested Sum
incomplete
6: Recursion Review
incomplete
7: Recursion on a Tree
incomplete
8: Dangers of Recursion
incomplete
9: Recursion Practice
incomplete
10: Recursion Practice
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Let's practice another simple recursive function.
You may not understand recursion just yet, but by following the instructions, you will begin to grasp the fundamentals.
Within Doc2Doc we need to map certain properties from one document to properties of another document. Complete the recursive zipmap function.
It takes two lists as input and returns a dictionary where the first list provides the keys and the second list provides the values.
Example usage:
zipped: dict[str, float] = zipmap(
[
"Avatar: The Last Airbender",
"Avatar (in Papyrus font)",
"The Last Airbender (Live Action)",
],
[9.9, 6.1, 2.1],
)
print(zipped)
# {
# 'Avatar: The Last Airbender': 9.9,
# 'Avatar (in Papyrus font)': 6.1,
# 'The Last Airbender (Live Action)': 2.1,
# }
Here's the pseudocode: