-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01-basic-calculator.py
More file actions
27 lines (24 loc) · 906 Bytes
/
Copy path01-basic-calculator.py
File metadata and controls
27 lines (24 loc) · 906 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
print("Welcome to Basic Calculator")
while True:
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("0. Exit")
option = input("Choose an option: ")
if option == "0":
print("Thank you for using Basic Calculator.")
break
else:
first_number = int(input("Enter your first number: "))
second_number = int(input("Enter your second number: "))
if option == "1":
print(f"Your result is {first_number + second_number}\n")
elif option == "2":
print(f"Your result is {first_number - second_number}\n")
elif option == "3":
print(f"Your result is {first_number * second_number}\n")
elif option == "4":
print(f"Your result is {first_number / second_number}\n")
else:
print("Invalid option. Try again.")