Skip to content

Instantly share code, notes, and snippets.

@ekohilas
Created Sep 4, 2017
Embed
What would you like to do?
A program to check if a number is odd or even
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