-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (24 loc) · 815 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (24 loc) · 815 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
# Declaration
first_number = 0
second_number = 0
opreation = ""
result = 0
# Take Input
first_number = int(input("Please enter the 1st number: ")) # "10" -> 10
second_number = int(input("Please enter the 2nd number: ")) # "20" -> 20
opreation = input("Please enter one of + - * or /: ")
# Process the Input
if opreation == "+":
result = first_number + second_number
elif opreation == "-":
result = first_number - second_number
elif opreation == "*":
result = first_number * second_number
elif opreation == "/": #or we can use this code elif opreation == "/": and second_number > 0:
if second_number > 0: # by deleting this code
result = first_number / second_number
else:
print("[WARN]opreation not supported!")
# Output
print("Result is: ", result, "!!!")
print("End of Script")