Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ num2 = st.number_input('Enter second number', value=0)
|
|
| 9 |
num3 = st.number_input('Enter third number', value=0)
|
| 10 |
|
| 11 |
# Create options for selecting the type of operation
|
| 12 |
-
operation = st.selectbox('Choose operation', ('Add', 'Subtract', 'Multiply', 'Divide', 'Average', '
|
| 13 |
|
| 14 |
# Perform calculation based on the selected operation
|
| 15 |
if operation == 'Add':
|
|
@@ -25,8 +25,10 @@ elif operation == 'Divide':
|
|
| 25 |
result = 'Error! Division by Zero'
|
| 26 |
elif operation == 'Average':
|
| 27 |
result = (num1 + num2 + num3) / 3
|
| 28 |
-
elif operation == '
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
elif operation == 'Modulus':
|
| 31 |
if num2 != 0 and num3 != 0:
|
| 32 |
result = num1 % num2 % num3
|
|
|
|
| 9 |
num3 = st.number_input('Enter third number', value=0)
|
| 10 |
|
| 11 |
# Create options for selecting the type of operation
|
| 12 |
+
operation = st.selectbox('Choose operation', ('Add', 'Subtract', 'Multiply', 'Divide', 'Average', 'Exponentiation', 'Modulus'))
|
| 13 |
|
| 14 |
# Perform calculation based on the selected operation
|
| 15 |
if operation == 'Add':
|
|
|
|
| 25 |
result = 'Error! Division by Zero'
|
| 26 |
elif operation == 'Average':
|
| 27 |
result = (num1 + num2 + num3) / 3
|
| 28 |
+
elif operation == 'Exponentiation':
|
| 29 |
+
base = st.number_input('Enter the base number', value=1) # Get base input from the user
|
| 30 |
+
exponent = st.number_input('Enter the exponent number', value=1) # Get exponent input from the user
|
| 31 |
+
result = base ** exponent # Exponentiation calculation
|
| 32 |
elif operation == 'Modulus':
|
| 33 |
if num2 != 0 and num3 != 0:
|
| 34 |
result = num1 % num2 % num3
|