Can someone help me how to convert this section to dictionary? (list to dictionary)
Thanks a lot!!
def count_weekday(weekdays):
weekdays_counter = [0] * 7
for weekday in weekdays:
if weekday == "Mon":
weekdays_counter[0] = weekdays_counter[0] + 1
elif weekday == "Tue":
weekdays_counter[1] = weekdays_counter[1] + 1
elif weekday == "Wed":
weekdays_counter[2] = weekdays_counter[2] + 1
elif weekday == "Thu":
weekdays_counter[3] = weekdays_counter[3] + 1
elif weekday == "Fri":
weekdays_counter[4] = weekdays_counter[4] + 1
elif weekday == "Sat":
weekdays_counter[5] = weekdays_counter[5] + 1
elif weekday == "Sun":
weekdays_counter[6] = weekdays_counter[6] + 1
return weekdays_counter
Answers
Answered by
2
Answer:
sry I don't know this answer
Similar questions