Unit 2 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop through the dict, and if the key is odd and value even, add the key to an output list.
1) Results list starts empty
2) For each key and value in the input dict
a) If the key is odd and value even, add key to results
3) Return results
⚠️ Common Mistakes
def odd_keys_even_values(dictionary):
result_keys = []
for key, value in dictionary.items():
if key % 2 != 0 and value % 2 == 0:
result_keys.append(key)
return result_keys