houses = ["Shaah's house", "Joseph's house", "Kyle's house", "Stan's house"]def deliver_presents_recursively(houses): # Worker elf doing his work if len(houses) == 1: house = houses[0] print("Delivering presents to", house) else: mid = len(houses) // 2 first_half = houses[:mid] second_half = houses[mid:] # Divides his work among two elves deliver_presents_recursively(first_half) deliver_presents_recursively(second_half)交付呈现_递归(房屋)
添加回答
举报
0/150
提交
取消