I'm trying to implement dict in python.
This code work perfectly:
def numbers_to_strings(argument):
switcher = {
0: "zero",
1: "one",
2: "two",
}
return switcher.get(argument, "nothing")
print (numbers_to_strings(0))
In this case the output is "zero".
But when I try to implement the one by input , I always get "nothing" :
def numbers_to_strings(argument):
switcher = {
0: "zero",
1: "one",
2: "two",
}
return switcher.get(argument, "nothing")
print ("To write a number: ")
number = input ()
print (numbers_to_strings(number))
Best Regards.