diff --git a/.idea/misc.xml b/.idea/misc.xml
index 36e7663..232b71f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/.idea/setupCheck.iml b/.idea/setupCheck.iml
index 7584dbd..b6731d8 100644
--- a/.idea/setupCheck.iml
+++ b/.idea/setupCheck.iml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/src/function.py b/src/function.py
new file mode 100644
index 0000000..d31a5a0
--- /dev/null
+++ b/src/function.py
@@ -0,0 +1,48 @@
+from main import main
+
+def ask_user_input():
+
+ global operand1
+ # Get first operand from the user
+ operand1 = float(input("Enter the first operand: "))
+
+ global operator
+ # Get the operator from the user
+ operator = input("Enter an operator (+, -, *, /): ")
+
+ global operand2
+ # Get second operand from the user
+ operand2 = float(input("Enter the second operand: "))
+
+ return operand1, operator, operand2
+
+def calculate(ope1, oper, ope2):
+ # Perform the operation based on the operator
+ res = None
+ match operator:
+ case '+':
+ res = (operand1 + operand2)
+
+ case '-':
+ res = (operand1 - operand2)
+
+ case '*':
+ res = (operand1 * operand2)
+
+ case '/':
+ if ope2 == 0:
+ print("Error: Division by zero is undefined.")
+ return
+ res = (ope1 / ope2)
+
+ case _:
+ print("Error: Operator '{}' not recognized.".format(operator))
+ return
+
+ return res
+
+def display_result(ope1, oper, ope2, res):
+ print(f"{ope1} {oper} {ope2}={res}")
+
+
+
diff --git a/src/main.py b/src/main.py
index 47ce342..eb8dc60 100644
--- a/src/main.py
+++ b/src/main.py
@@ -1,32 +1,56 @@
+
+
def main():
+ ask_user_input()
+ global result
+ result = calculate(operand1, operator, operand2)
+ display_result(operand1, operator, operand2, result)
+
+def ask_user_input():
+
+ global operand1
# Get first operand from the user
operand1 = float(input("Enter the first operand: "))
+ global operator
# Get the operator from the user
operator = input("Enter an operator (+, -, *, /): ")
+ global operand2
# Get second operand from the user
operand2 = float(input("Enter the second operand: "))
+ return operand1, operator, operand2
+
+def calculate(ope1, oper, ope2):
# Perform the operation based on the operator
- if operator == '+':
- result = operand1 + operand2
- elif operator == '-':
- result = operand1 - operand2
- elif operator == '*':
- result = operand1 * operand2
- elif operator == '/':
- if operand2 == 0:
- print("Error: Division by zero is undefined.")
+ res = None
+ match operator:
+ case '+':
+ res = (operand1 + operand2)
+
+ case '-':
+ res = (operand1 - operand2)
+
+ case '*':
+ res = (operand1 * operand2)
+
+ case '/':
+ if ope2 == 0:
+ print("Error: Division by zero is undefined.")
+ return
+ res = (ope1 / ope2)
+
+ case _:
+ print("Error: Operator '{}' not recognized.".format(operator))
return
- result = operand1 / operand2
- else:
- print("Invalid operator.")
- return
- # Print the result
- print("Result:", result)
+ return res
+def display_result(ope1, oper, ope2, res):
+ print(f"{ope1}' '{oper}' '{ope2}'='{res}")
# Call the main function to run the program
-main()
\ No newline at end of file
+main()
+
+