Created
September 4, 2017 04:17
-
-
Save ekohilas/5b2bd98dec5b50bb09fb5eb1d091e3f8 to your computer and use it in GitHub Desktop.
A program to check if a number is odd or even
This file contains hidden or 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
| NUMBERS = { | |
| 0: "zero", | |
| 1: "one", | |
| 2: "two", | |
| 3: "three", | |
| 4: "four", | |
| 5: "five", | |
| 6: "six", | |
| 7: "seven", | |
| 8: "eight", | |
| 9: "nine" | |
| } | |
| number = input("Enter a number: ") | |
| word = NUMBERS[int(number[-1])] | |
| if "e" in word[-2:]: | |
| print(f"{number} is odd") | |
| else: | |
| print(f"{number} is even") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment