Shahid commited on
Commit
4ddfe35
1 Parent(s): b6a11de

added new code

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. calculator.py +5 -1
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import streamlit as st
2
- from calculator import add, subtract, multiply, divide
3
 
4
  st.title("Calculator App")
5
 
6
- operation = st.selectbox("Select operation:", ["Add", "Subtract", "Multiply", "Divide"])
7
  x = st.number_input("Enter first number:", value=0)
8
  y = st.number_input("Enter second number:", value=0)
9
 
@@ -16,4 +16,6 @@ if st.button("Calculate"):
16
  result = multiply(x, y)
17
  elif operation == "Divide":
18
  result = divide(x, y)
 
 
19
  st.write(f"The result is: {result}")
 
1
  import streamlit as st
2
+ from calculator import add, subtract, multiply, divide,greater
3
 
4
  st.title("Calculator App")
5
 
6
+ operation = st.selectbox("Select operation:", ["Add", "Subtract", "Multiply", "Divide", "Greater than"])
7
  x = st.number_input("Enter first number:", value=0)
8
  y = st.number_input("Enter second number:", value=0)
9
 
 
16
  result = multiply(x, y)
17
  elif operation == "Divide":
18
  result = divide(x, y)
19
+ elif operation=="Greater than":
20
+ result= greater(x,y)
21
  st.write(f"The result is: {result}")
calculator.py CHANGED
@@ -11,7 +11,11 @@ def divide(x, y):
11
  if y == 0:
12
  return "Cannot divide by zero!"
13
  return x / y
14
-
 
 
 
 
15
  if __name__ == "__main__":
16
  print("Select operation:")
17
  print("1.Add")
 
11
  if y == 0:
12
  return "Cannot divide by zero!"
13
  return x / y
14
+ def greater(x,y):
15
+ if x > y:
16
+ return x
17
+ else:
18
+ return y
19
  if __name__ == "__main__":
20
  print("Select operation:")
21
  print("1.Add")