-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiproject01.py
More file actions
46 lines (33 loc) · 922 Bytes
/
Copy pathminiproject01.py
File metadata and controls
46 lines (33 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#-------------------------------------
#Miniproject:"Menu-driven program"
#-------------------------------------
print("This is my Mini Project 1
\nTitle: Menu-driven program")
print("Enter the Options:\n1. Addition \n2. Subtraction \n3. Multiplication \n4.Division")
choice=int(input("Select your choice:"))
if choice not in (1,2,3,4):
print("Invalid choice")
else:
num1=float(input("Enter the first number:"))
num2=float(input("Enter the second number:"))
if(choice==1):
res= num1+num2
print("Sum=",res)
elif(choice==2):
if(num1>num2):
res=num1-num2
print("Difference=",res)
else:
res=num2-num1
print("Difference=",res)
elif(choice==3):
res=num1*num2
print("Product=",res)
else:
if(num2!=0):
res=(num1/num2)
print("Quotient=",res)
else:
print("Division is not possible!")
print("Successfully executed!")
print("---------------------------------")