Question: Python Toffy Apples! Chocolate pudding! Fruit Salad! You're running a poll to find out your friends' favourite dessert and decide to write a program to
Python


Toffy Apples! Chocolate pudding! Fruit Salad! You're running a poll to find out your friends' favourite dessert and decide to write a program to help you keep track of all the suggestions and who voted for each Your program should keep reading in lines (until an empty line) which contain the person's name, then a colon(:) then their favourite dessert. Your program should work like this, printing out the results in any order: Name:vote Greg:chocolate Name: vote Teena macaroons Name:vote Georgina:apple pie Name: vote wiu: chocolate Name:vote Sophia:gelato Name: vote Sam:ice cream Name: vote James: chocolate Name:vote Kirsten:gelato Name:vote apple pie 1 vote (s): Georgina gelato 2 vote (s): Sophia Kirsten chocolate 3 vote (s): Greg Will James macaroons 1 vote (s) Teena ice cream 1 vote (s): Sam Here's another example, with no two votes for the same dessert: Name:vote Harry:treacle tart Name:vote Hermione:chocolate frogs Name:vote Hagrid:rock cake Name: vote Ron:pumpkin pasties
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
