Skip to content

Instantly share code, notes, and snippets.

@ekohilas
Created September 4, 2017 04:17
Show Gist options
  • Select an option

  • Save ekohilas/5b2bd98dec5b50bb09fb5eb1d091e3f8 to your computer and use it in GitHub Desktop.

Select an option

Save ekohilas/5b2bd98dec5b50bb09fb5eb1d091e3f8 to your computer and use it in GitHub Desktop.
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