I need to create a voting system for the best suitable weekday for a meeting using only built-in functions. For that, I've created the following dictionary:
days = {'Sunday':0,
'Monday':1,
'Tuesday':2,
'Wednesday':3,
'Thursday':4,
'Friday':5,
'Saturday':6}
Each individual would choose the most convenient day for them by inputting a corresponding number. Also, by inserting -5, the program would print the number of votes each day got as well as the winner:
Input:
1
3
3
5
5
5
0
6
-5
Output:
Sunday = 1
Monday = 1
Tuesday = 0
Wednesday = 2
Thursday = 0
Friday = 3
Saturday = 1
The winner is Friday.
Ties can be disregarded.
As I'm a beginner, I don't know if dictionaries are the best solution. Any suggestions?
I have just solved a similar question. Yours is slightly different because you don't want to use any libraries.
The Code is:
Note that they have to enter the day names, and to quite by typing "DONE", if you insist in your version, go ahead and change it.