I have this code:
import random
import datetime
def greet():
response = random.choice(['hello sir', 'hi sir', 'welcome sir'])
print(response)
def time():
time = datetime.datetime.now().strftime('%I:%M %p')
response = random.choice(['current time is', 'the time is', 'time is'])
print(response + time)
commands = {'greet me': greet, 'what is the time': time}
while True:
command = input('Enter your message: ')
if command in commands:
then I want it to execute the function according to the user input