Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import sympy as sp
|
|
|
|
| 3 |
|
| 4 |
# Function to solve algebraic equations
|
| 5 |
def solve_equation(equation):
|
|
@@ -60,7 +61,9 @@ def find_factors(number):
|
|
| 60 |
for i in range(1, number + 1):
|
| 61 |
if number % i == 0:
|
| 62 |
factors.append(i)
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
|
| 65 |
# Streamlit Interface
|
| 66 |
def main():
|
|
@@ -111,13 +114,21 @@ def main():
|
|
| 111 |
|
| 112 |
elif tab == "Find Factors of a Number":
|
| 113 |
st.header("Find Factors of a Number")
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
| 115 |
if st.button("Find Factors"):
|
| 116 |
-
if
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
else:
|
| 120 |
-
st.write("Please enter
|
| 121 |
|
| 122 |
# Run the app
|
| 123 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import sympy as sp
|
| 3 |
+
import pandas as pd
|
| 4 |
|
| 5 |
# Function to solve algebraic equations
|
| 6 |
def solve_equation(equation):
|
|
|
|
| 61 |
for i in range(1, number + 1):
|
| 62 |
if number % i == 0:
|
| 63 |
factors.append(i)
|
| 64 |
+
# Creating a DataFrame to show factors in a table format
|
| 65 |
+
df = pd.DataFrame(factors, columns=["Factors"])
|
| 66 |
+
return df
|
| 67 |
|
| 68 |
# Streamlit Interface
|
| 69 |
def main():
|
|
|
|
| 114 |
|
| 115 |
elif tab == "Find Factors of a Number":
|
| 116 |
st.header("Find Factors of a Number")
|
| 117 |
+
|
| 118 |
+
# Input: Let user enter multiple numbers as comma-separated values
|
| 119 |
+
numbers_input = st.text_input("Enter numbers separated by commas (e.g., 10, 15, 20)", "")
|
| 120 |
+
|
| 121 |
if st.button("Find Factors"):
|
| 122 |
+
if numbers_input:
|
| 123 |
+
# Parse the input and generate tables for each number
|
| 124 |
+
numbers = [int(x.strip()) for x in numbers_input.split(',')]
|
| 125 |
+
|
| 126 |
+
for num in numbers:
|
| 127 |
+
factors_df = find_factors(num)
|
| 128 |
+
st.write(f"Factors of {num}:")
|
| 129 |
+
st.table(factors_df) # Display the factors as a table
|
| 130 |
else:
|
| 131 |
+
st.write("Please enter numbers!")
|
| 132 |
|
| 133 |
# Run the app
|
| 134 |
if __name__ == "__main__":
|