Science, asked by asifazeezeau, 5 months ago

write a progr to perform following task using users choice using menu​

Answers

Answered by Caramelicious
0

\pink:\implies Here's an example of a program that allows the user to perform various tasks based on their choice using a menu:

def task_1( ):

   print("Performing task 1...")

   # Add your code for task 1 here

def task_2( ):

   print("Performing task 2...")

  # Add your code for task 2 here

def task_3( ):

   print("Performing task 3...")

   # Add your code for task 3 here

def task_4( ):

   print("Performing task 4...")

   # Add your code for task 4 here

while True:

   print("Menu:")

   print("1. Perform Task 1")

   print("2. Perform Task 2")

   print("3. Perform Task 3")

   print("4. Perform Task 4")

   print("0. Exit")

   choice = input("Enter your choice (0-4) : " )

   if choice == "1" :

       task_1()

   elif choice == "2" :

       task_2()

   elif choice == "3" :

       task_3()

   elif choice == "4" :

       task_4()

   elif choice == "0" :

       print("Exiting...")

       break

   else:

       print("Invalid choice. Please try again.")

In this program, the user is presented with a menu displaying different tasks. The user can enter a number corresponding to their desired task. Based on the user's choice, the program calls the respective task function ( `task_1( )`, `task_2( )`, `task_3( )`, `task_4( )` ) or exits the program if the choice is '0'. You can add your own code or functionality within each task function to perform the desired tasks.

Similar questions