Exercise 10: Zip Two Lists into a Dictionary, Manually — Possible Solution ==================================================================== keys = ["name", "age", "city"] values = ["Priya", 29, "Leeds"] result = {} index = 0 shortest_length = min(len(keys), len(values)) while index < shortest_length: result[keys[index]] = values[index] index += 1 if len(keys) != len(values): print("Warning: keys and values were different lengths — extra items ignored") print(result) Output: {'name': 'Priya', 'age': 29, 'city': 'Leeds'} WHY THIS WORKS AS AN ANSWER ------------------------------ A single index walks both lists at the same time, using it to pull one key and one value per iteration — keys[index] and values[index] always refer to the "same position" in each list, which is exactly what zip(keys, values) does automatically under the hood. The min(len(keys), len(values)) bound is the part that's easy to skip and then regret: if the two lists are different lengths, looping to len(keys) would eventually try values[index] past the end of a shorter values list and raise an IndexError. Bounding the loop by whichever list is SHORTER guarantees every index used is valid in both lists, and the extra warning message makes the mismatch visible rather than silently dropping data with no explanation. This is the same "decide what should happen at the boundary" thinking as Exercise 9's collision handling — a while loop won't make that decision for you the way a built-in function might.