Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def zero ():
- return "zero"
- def one ():
- return "one"
- def two ():
- return "two"
- def three ():
- return "three"
- def four ():
- return "four"
- def five ():
- return "five"
- def six ():
- return "six"
- def seven ():
- return "seven"
- def eight ():
- return "eight"
- def nine ():
- return "nine"
- def default ():
- return("not a digit")
- switcher = {
- 1: one,
- 2: two,
- 3: three,
- 4: four,
- 5: five,
- 6: six,
- 7: seven,
- 8: eight,
- 9: nine
- }
- def switch(digit):
- return switcher.get(digit, default)()
- print(switch(-0.1))
- print(switch(1))
- print(switch(9))
- print(switch(-9))
- print(switch("kek"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement