I have to create a function in Python that matches keypad letters with their corresponding number(excluding 1 & 0).
When I run my code and input a letter, I get the correct match, but I also get a (letter,"matches",None) line below it. What am I doing wrong and what do I need to fix to make sure that the None line doesn't occur?
Code:
def keypad(ch):
if ch == "A" or ch == "a" or ch == "B" or ch == "b" or ch == "C" or ch == "c":
print(ch,"matches",2)
elif ch == "D" or ch == "d" or ch == "E" or ch == "e" or ch == "F" or ch == "f":
print(ch,"matches",3)
s = str(input("Enter a letter:"))
print(s,"matches",keypad(s))
Sample output for this:
Enter a letter:D
D matches 3
D matches None