Example done 2/16 11am lecture

Problem is to ask the user for some information about pizzas sold and report the total. The desired behavior is

How many pizzas sold on Monday? 23 How many pizzas sold on Tuesday? 32 How many pizzas sold on Wednesday? 4 How many pizzas sold on Thursday? 35 How many pizzas sold on Friday? 15 Total is 109 pizzasOne way to do it is just brute force, many variables, long expression to find the total.

But a more elegant way is

totalpizzas = 0 for day in ["Monday","Tuesday","Wednesday","Thursday", "Friday"]: numpizzas = int (input("How many pizzas sold on "+day)) totalpizzas = totalpizzas + numpizzas print("Total is", totalpizzas, "pizzas")