Generation

generate functionSun, 11 Dec 2022

Write a function that multiplies each dictionary value by portions portions = 5 grams = 0 y = {'Marlboro': [3, 13, 6, 66, 13, 7, 13]} for el in y.get('Marlboro'): el * portions print(el)

out = (x*5 for x in y) y = {'Marlboro': [3, 13, 6, 66, 13, 7, 13]} for el in y.get('Marlboro'): el * portions print(el)

Questions about programming?Chat with your personal AI assistant