-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditional_calculator.py
More file actions
46 lines (40 loc) · 1.21 KB
/
Copy pathconditional_calculator.py
File metadata and controls
46 lines (40 loc) · 1.21 KB
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
46
"""
Filename: conditional_calculator.py
Author: <Carcamo, Fredys>
Created: <9/9/2025>
Instructor: Holtslander
"""
# num = input("type a number.\n")
# num = int(num)
# if num % 2 == 0:
# print(f"{num} is an even number.")
# elif num % 5 == 0:
# print(f"{num} is divisible by 5.")
# else:
# print(f"{num} is an odd number.")
# print("Done.")
num1 = input("Please enter your first number without any commas.\n")
op = input("PLease type your operator.\n"
"+: For addition\n"
"-: For subtraction\n"
"*: For multiplication\n"
"/: For division\n")
num2 = input("Please enter your second number without any commas.\n")
num1 = int(num1)
num2 = int(num2)
if op == "+":
print(f"{num1} + {num2} = {num1 + num2}")
elif op == "-":
print(f"{num1} - {num2} = {num1 - num2}")
elif op == "*":
print(f"{num1} * {num2} = {num1 * num2}")
elif op == "/":
print(f"{num1} / {num2} = {num1 / num2}")
elif op != "+":
print("This function is not supported.")
elif op != "-":
print("This function is not supported.")
elif op != "*":
print("This function is not supported.")
elif op != "/":
print("This function is not supported.")