What would be the output of the following code? If there is…
What would be the output of the following code? If there is an error, write “ERROR” cities = { “Tokyo”: 37, “Delhi”: 31, “Shanghai”: 28}cities[“Mumbai”] = 21del cities[“Shanghai”]print(len(cities), “NYC” in cities, cities.get(“Shanghai”, 0))
Read DetailsWhat would be the output of the following code? If there is…
What would be the output of the following code? If there is an error, write “ERROR” def transform_list(nums, depth): if depth == 0: return nums else: new_nums = [nums[i] * (i + 1) for i in range(len(nums))] return transform_list(new_nums, depth – 1)result = transform_list([2, 3, 1], 2)print(sum(result))
Read Details