Shehroz-Ali-02 commited on
Commit
09e7a8a
·
verified ·
1 Parent(s): 5480678

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
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', 'Power', 'Modulus'))
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 == 'Power':
29
- result = num1 ** num2 ** num3
 
 
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