Skip to content

Instantly share code, notes, and snippets.

@MaiLinhGroup
Created August 31, 2021 13:51
Show Gist options
  • Save MaiLinhGroup/183b1c698dde04b16151969e9e9735a5 to your computer and use it in GitHub Desktop.
Save MaiLinhGroup/183b1c698dde04b16151969e9e9735a5 to your computer and use it in GitHub Desktop.
Python switch case with dictionary
def week_num2dayname(i: int) -> str:
switcher = {
1: 'Monday',
2: 'Tuesday',
3: 'Wednesday',
4: 'Thursday',
5: 'Friday',
6: 'Saturday,
7: 'Sunday
}
return switcher.get(i, 'invalid number: ' + i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment