Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to retrieve a memory by its unique key.
Agentic AI
retrieved_memory = memory_store.[1]('user_123')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'append' which is for lists, not dictionaries.
Using 'remove' which deletes data instead of retrieving.
Using 'update' which changes data instead of fetching.
✗ Incorrect
The 'get' method retrieves the value for the given key from the memory store.
2fill in blank
mediumComplete the code to check if a memory key exists before retrieval.
Agentic AI
if '[1]' in memory_store: data = memory_store['[1]']
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of the actual key string.
Forgetting to check key existence before access.
✗ Incorrect
We check if the specific key 'user_456' exists in the memory store before accessing it.
3fill in blank
hardFix the error in the code to retrieve the most recent memory entry.
Agentic AI
recent_memory = memory_list.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'append' which adds items instead of retrieving.
Using 'sort' which rearranges the list but does not retrieve an item.
Using 'clear' which empties the list.
✗ Incorrect
The 'pop' method removes and returns the last item, which is the most recent memory in a list.
4fill in blank
hardFill both blanks to filter memories with scores above 80.
Agentic AI
high_scores = {mem: score for mem, score in memory_scores.items() if score [1] [2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which filters lower scores.
Using '==' which filters only exact matches.
✗ Incorrect
We use '>' to filter scores greater than 80.
5fill in blank
hardFill all three blanks to create a dictionary of memories with length greater than 5.
Agentic AI
filtered_memories = { [1]: [2] for [3] in memories if len(memories[[3]]) > 5 } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Using the key as the value instead of accessing the dictionary.
✗ Incorrect
We use 'mem' as the key variable, 'memories[mem]' as the value, and iterate with 'mem' over memories.