Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,12 +52,20 @@ def solve_word_problem(operation, num1, num2):
|
|
| 52 |
except Exception as e:
|
| 53 |
return f"Error: {e}"
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Streamlit Interface
|
| 56 |
def main():
|
| 57 |
st.title("Math Problem-Solution App")
|
| 58 |
|
| 59 |
# Tabs for different functionalities
|
| 60 |
-
tab = st.radio("Select a problem type:", ["Solve Algebraic Equation", "Simplify Expression", "Factor Expression", "Solve Word Problem"])
|
| 61 |
|
| 62 |
if tab == "Solve Algebraic Equation":
|
| 63 |
st.header("Solve Algebraic Equation")
|
|
@@ -98,6 +106,16 @@ def main():
|
|
| 98 |
result = solve_word_problem(operation, num1_input, num2_input)
|
| 99 |
st.write(result)
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
# Run the app
|
| 102 |
if __name__ == "__main__":
|
| 103 |
main()
|
|
|
|
| 52 |
except Exception as e:
|
| 53 |
return f"Error: {e}"
|
| 54 |
|
| 55 |
+
# Function to find the factors of a number
|
| 56 |
+
def find_factors(number):
|
| 57 |
+
factors = []
|
| 58 |
+
for i in range(1, number + 1):
|
| 59 |
+
if number % i == 0:
|
| 60 |
+
factors.append(i)
|
| 61 |
+
return factors
|
| 62 |
+
|
| 63 |
# Streamlit Interface
|
| 64 |
def main():
|
| 65 |
st.title("Math Problem-Solution App")
|
| 66 |
|
| 67 |
# Tabs for different functionalities
|
| 68 |
+
tab = st.radio("Select a problem type:", ["Solve Algebraic Equation", "Simplify Expression", "Factor Expression", "Solve Word Problem", "Find Factors of a Number"])
|
| 69 |
|
| 70 |
if tab == "Solve Algebraic Equation":
|
| 71 |
st.header("Solve Algebraic Equation")
|
|
|
|
| 106 |
result = solve_word_problem(operation, num1_input, num2_input)
|
| 107 |
st.write(result)
|
| 108 |
|
| 109 |
+
elif tab == "Find Factors of a Number":
|
| 110 |
+
st.header("Find Factors of a Number")
|
| 111 |
+
number_input = st.number_input("Enter a number", min_value=1)
|
| 112 |
+
if st.button("Find Factors"):
|
| 113 |
+
if number_input:
|
| 114 |
+
factors = find_factors(number_input)
|
| 115 |
+
st.write(f"Factors of {number_input}: {factors}")
|
| 116 |
+
else:
|
| 117 |
+
st.write("Please enter a number!")
|
| 118 |
+
|
| 119 |
# Run the app
|
| 120 |
if __name__ == "__main__":
|
| 121 |
main()
|