I need a program that get a 1 line input from user(text) and then give the output as text(I write an example down below)
I tried for if but it's only accept one line code and if I write a word that is not defined, it ruin the rest.
class meaning():
def shortcutA (self):
print ("ice cream")
def shortcutB (self):
print ("Choclet cake")
def main():
m = meaning()
if input() == "a":
print("your code is: ")
m.shortcutA()
elif input() == "b":
print("your code is: ")
m.shortcutB()
else :
print ("unrecognized")
print ("Please enter the words :")
if __name__ == "__main__":
main()
I expect when I enter a b the result be like
ice cream
Choclet cake
Thank you.