KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My task is to define a function weekdays(weekday) that returns a list of weekdays, starting with the given weekday . It should work like this: >>> weekdays('Wednesday') ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday'] So far I've come up with this one: def weekdays(weekday): days = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') result = "" for day in days: if day == weekday: result += day return result But this prints the input day only: >>> weekdays("Sunday") 'Sunday' What am I doing wrong?
Tags (comma-separated)
Save Edits
Cancel