Syed200 commited on
Commit
b7792f0
·
verified ·
1 Parent(s): 406bd71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -33
app.py CHANGED
@@ -84,36 +84,3 @@ if st.button("Calculate"):
84
  st.error(error)
85
  else:
86
  st.success(f"Result: {result:.6f}")
87
- import streamlit as st
88
-
89
- st.title("Simple Calculator")
90
-
91
- # Input fields
92
- num1 = st.number_input("Enter first number", format="%.2f")
93
- operation = st.selectbox("Select operation", ["+", "-", "*", "/"])
94
- num2 = st.number_input("Enter second number", format="%.2f")
95
-
96
- # Perform calculation
97
- result = None
98
- error = None
99
-
100
- if st.button("Calculate"):
101
- try:
102
- if operation == "+":
103
- result = num1 + num2
104
- elif operation == "-":
105
- result = num1 - num2
106
- elif operation == "*":
107
- result = num1 * num2
108
- elif operation == "/":
109
- if num2 != 0:
110
- result = num1 / num2
111
- else:
112
- error = "Cannot divide by zero"
113
- except Exception as e:
114
- error = str(e)
115
-
116
- if error:
117
- st.error(error)
118
- else:
119
- st.success(f"Result: {result:.2f}")
 
84
  st.error(error)
85
  else:
86
  st.success(f"Result: {result:.6f}")