Please help me with the task: Functional Module.

Hello, I’m working on this task:

Noname’s functional module consists of 4 functions: from_a_to_f, from_g_to_l, from_m_to_r, and from_s_to_z, but Noname doesn’t know when to call which one. You need to write a program - think of it as a dispatcher - that routes an entered command to the correct function. You should read input commands from the console and if the command begins with a letter in the English alphabet that is located between “a” and “f”, such as “fix” or “Comment,” you should call function from_a_to_f with the command as a parameter. If the first letter of the command is between “g” and “l”, you should call from_g_to_l, again with the command as a parameter. Similarly, if the first letter is between “m” and “r”, call from_m_to_r with the command as a parameter, and in all other cases, call **from_s_to_z **with the command as a parameter. For this program, commands are guaranteed to start with a letter. But pay attention: it can be either an uppercase or lowercase letter; for example, “fix” or “Fix”. Your program should therefore be case-insensitive. The program should listen to the input commands, and when one is given, run the method corresponding to that command. When the user types “exit”, the program should exit. For example:

collapse

from_a_to_f executes collapse.

Globalize

from_g_to_l executes Globalize.

optimize

from_m_to_r executes optimize.

Wrap

from_s_to_z executes Wrap.

exit

Here is my code:


def from_a_to_f(command):
   print(f"from_a_to_f executes {command}.")

def from_g_to_l(command):
   print(f"from_g_to_l executes {command}.")

def from_m_to_r(command):
   print(f"from_m_to_r executes {command}.")

def from_s_to_z(command):
   print(f"from_s_to_z executes {command}.")


def dispatch_command(command):
   first_letter = command[0].lower()


   if 'a' <= first_letter <= 'f':
       from_a_to_f(command)
   elif 'g' <= first_letter <= 'l':
       from_g_to_l(command)
   elif 'm' <= first_letter <= 'r':
       from_m_to_r(command)
   elif 's' <= first_letter <= 'z':
       from_s_to_z(command)

while True:
   command = input("Enter command: ")
   if command.lower() == "exit":
       break
   dispatch_command(command)

Can anyone please help me to solve it?