Chương trình điều khiển menu trong python sử dụng vòng lặp for

Trong bài viết này, chúng ta sẽ tạo một chương trình Python điều khiển bằng menu, chương trình này sẽ thực thi công cụ người dùng yêu cầu khi người dùng cung cấp đầu vào dưới dạng văn bản

Chúng ta có thể tương tác với HĐH thông qua GUI (giao diện người dùng đồ họa) và CLI (giao diện dòng lệnh). Chúng tôi cũng có thể đưa ra hướng dẫn cho HĐH thông qua ngôn ngữ lập trình. Trong chương trình này, bạn có thể hướng dẫn hệ điều hành bằng Python. Chương trình này đưa ra ý tưởng về cách chúng tôi có thể tạo ChatBot dựa trên quy tắc

Trong chương trình này, chúng tôi sẽ sử dụng os. phương thức system() của mô-đun hệ điều hành. Phương thức này thực thi lệnh (một chuỗi) trong một lớp con

cú pháp. hệ điều hành. hệ thống (lệnh)

Quay lại. Trên Unix, giá trị trả về là trạng thái thoát của tiến trình và trên Windows, giá trị trả về là giá trị được shell hệ thống trả về sau khi chạy lệnh.
 

Hãy xem việc thực hiện.  

Python3




# import os library

import os

 

# infinite while loop

while True:

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2import0import1

_______10____11____12____45import1

_______10____11____12____50import1

_______10____11____12____55import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2# infinite while loop0import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2# infinite while loop5import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while0import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while5import1

_______10____11____12____80import1

_______10____11____12____85import1

_______10____11____12____90import1

_______10____11____12____95import1

_______10____11____12____100import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
05import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
10import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
15import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
20import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0______11
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
25
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
26
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
27
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
28import1

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0import02

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0____404
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
27 import06import07

import08

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0____410

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0_______412 import13import14 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2import19 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2import24 import15 import26

import27

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
1____12import30import1

import27

PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
0_______434 import13while07 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while12 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while17 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while22 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while27 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while22 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while27 import15 import16import17
PS C:\Users\Dell\Desktop\Python\> python menu.py

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:1
Enter radius of Circle:7
Area of Circle 153.86

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:2
Enter length of Rectangle:4
Enter breadth of Rectangle:5
Area of Rectangle:20

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:3
Enter side of Square:4
Area of Square:16

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:5
wrong choice

Menu Driven Program
1.Area of Circle
2.Area of Rectangle
3.Area of Square
4.Exit
Enter your choice:4

PS C:\Users\Dell\Desktop\Python\>
2while32 import1

Menu Driven Program trong Python sử dụng While Loop

  • đầu ra
  • Menu Driven Program trong Python sử dụng Hàm
  • Chương trình điều khiển menu trong Python. Ví dụ chương trình Python. Hướng dẫn chương trình Python
  • Từ cuối cùng
  • Menu Driven Program trong Python Bài viết là một bài viết sinh động vì chứa nhiều thông tin thú vị và được các bạn yêu thích.   

    Chương trình điều khiển bằng menu là chương trình nhận đầu vào từ người dùng bằng cách hiển thị danh sách các tùy chọn được gọi là menu, từ đó người dùng chọn lựa chọn của họ

    Hệ thống xử lý cho các chương trình điều khiển bằng menu là phổ biến, từ máy giặt được điều khiển bằng bộ vi xử lý đến máy rút tiền tự động (ATM)

    Hệ thống điều khiển theo menu được hưởng lợi theo hai cách. Đầu tiên, đầu vào được thực hiện bằng một lần nhấn phím, điều này làm giảm khả năng người dùng máy tính dễ mắc lỗi hơn. Thứ hai, các hệ thống Menu-Driven Systems giới hạn phạm vi ký tự, dẫn đến đầu vào bị mờ

    Chương trình điều khiển menu trong python sử dụng vòng lặp for
    Chương trình điều khiển menu trong python sử dụng vòng lặp for

    Xem Thêm Tại Đây

    Chúng ta sẽ tạo một chương trình điều khiển bằng menu trong python bằng cách sử dụng vòng lặp while

    while True:
        print("Menu Driven Program")
        print("1.Area of Circle")
        print("2.Area of Rectangle")
        print("3.Area of Square")    
        print("4.Exit")
        choice=int(input("Enter your choice:"))
        if choice==1:
            radius=int(input("Enter radius of Circle:"))
            print("Area of Circle",3.14*radius*radius)
        
        elif choice==2:
            length=int(input("Enter length of Rectangle:"))
            breadth=int(input("Enter breadth of Rectangle:"))
            print("Area of Rectangle:",length*breadth)
        
        elif choice==3:
            side=int(input("Enter side of Square:"))
            print("Area:",side*side)
        elif choice==4:
            break
        else:
            print("Wrong Choice")

    đầu ra

    Hàm print() dùng để hiển thị kết quả ra màn hình như bên dưới

    PS C:\Users\Dell\Desktop\Python\> python menu.py
    
    Menu Driven Program
    1.Area of Circle
    2.Area of Rectangle
    3.Area of Square
    4.Exit
    Enter your choice:1
    Enter radius of Circle:7
    Area of Circle 153.86
    
    Menu Driven Program
    1.Area of Circle
    2.Area of Rectangle
    3.Area of Square
    4.Exit
    Enter your choice:2
    Enter length of Rectangle:4
    Enter breadth of Rectangle:5
    Area of Rectangle:20
    
    Menu Driven Program
    1.Area of Circle
    2.Area of Rectangle
    3.Area of Square
    4.Exit
    Enter your choice:3
    Enter side of Square:4
    Area of Square:16
    
    Menu Driven Program
    1.Area of Circle
    2.Area of Rectangle
    3.Area of Square
    4.Exit
    Enter your choice:5
    wrong choice
    
    Menu Driven Program
    1.Area of Circle
    2.Area of Rectangle
    3.Area of Square
    4.Exit
    Enter your choice:4
    
    PS C:\Users\Dell\Desktop\Python\>
    def circle(radius):
        print("Area of Circle",3.14*radius*radius)
    
    def rectangle(length,breadth):
        print("Area of Rectangle:",length*breadth)
        
    def square(side):
        print("Area:",side*side)
    
    while True:
        print("Menu Driven Program")
        print("1.Area of Circle")
        print("2.Area of Rectangle")
        print("3.Area of Square")    
        print("4.Exit")
        choice=int(input("Enter your choice:"))
    
    
        if choice==1:
            radius=int(input("Enter radius of Circle:"))
            circle(radius)
    
    
        elif choice==2:
            length=int(input("Enter length of Rectangle:"))
            breadth=int(input("Enter breadth of Rectangle:"))
            rectangle(length,breadth)
        
        elif choice==3:
            side=int(input("Enter side of Square:"))
            square(side)
    
    
        elif choice==4:
            break
        else:
            print("Wrong Choice")

    đọc thêm. Python lặp qua các tệp trong thư mục

    Chương trình điều khiển menu trong Python. Ví dụ chương trình Python. Hướng dẫn chương trình Python

    Từ cuối cùng

    Tôi hy vọng bạn tìm thấy bài viết Menu Driven Program trong Python sử dụng. Lý do là chúng tôi đã nói với bạn tất cả các thông tin thông qua bài viết này theo cách mà bạn có thể hiểu. Và nếu bạn có bất kỳ nghi ngờ nào, bạn có thể bày tỏ nghi ngờ của mình thông qua hộp bình luận. Chúng tôi cũng yêu cầu bạn giúp chia sẻ bài viết này với bạn bè của bạn