Question: To solve this problem, I ll walk through the steps and how the code can structured. Here s a Python implementation: - Create a dictionary
To solve this problem, Ill walk through the steps and how the code can structured. Heres a Python implementation:
Create a dictionary of all the destinations and
how many people suggested the destination
def recorddestinations:
destination
return destination
Determine the favorite destination
Display the favorite destination and how many people people choose it or
display a message informing the user if no destinations were entered.
def printfavoritedestinationdestinationdictionary:
country
count
printcount "people suggested", country
Main Program
ToDo: call the appropriate functions
Use the starter code provided above.
Create the function recorddestinations.
Ask for the name of a destination.
Use a variable called placetovisit for the users suggested destination.
If the user presses enter, without entering a destination or if the destination is less than characters, an error message should be displayed.
Populate a dictionary called destinations, with the suggested destinations and how many people suggested the destination.
Done will be entered when all destinations are supplied.
Done can be spelled in upper lower or mixed case.
Create the function printfavouritedestinations.
The most popular destination name must be printed using titletitle will ensure that all words start with a capital letter and all the other letters are lowercase.
target "China"
printdestinationtitle
China
When done was entered, either display
o The most popular destination, as well as the number of people suggesting it or
o a message that no survey was done.
OUTPUT:
Target: Bolivia
Target: bolivia
Target: Chile
Target: south korea
Target: Bolivia
Target: Germany
Target: Done
suggested Bolivia
Target:
Invalid input
Target: W
Invalid Input
Target: Indonesia
Target: Indonesia
Target: Done
suggested Indonesia
Target: Done
No survey was made.
PLEASE NO AI OR CHATGPT, ADD COMMENTS ON THE CODES AS WELL FOR BETTER UNDERSTANDING
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
