Created
August 31, 2021 13:51
-
-
Save MaiLinhGroup/183b1c698dde04b16151969e9e9735a5 to your computer and use it in GitHub Desktop.
Python switch case with dictionary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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