Update app.py
Browse files
app.py
CHANGED
|
@@ -198,50 +198,58 @@ elif selected_function == "ๆฎ้ใฎ่จ่ฟฐๅผ่จ็ฎ":
|
|
| 198 |
st.error(f"ใจใฉใผ: {e}")
|
| 199 |
# ๅ้ก็ๆ
|
| 200 |
# ๅ้ก็ๆ
|
|
|
|
| 201 |
elif selected_function == "ๅ้ก็ๆ":
|
| 202 |
problem_option = st.radio("ๅ้กใชใใทใงใณใ้ธๆใใฆใใ ใใ:", ["ๅๅๆผ็ฎ", "ๅ ๆฐๅ่งฃ", "ๆน็จๅผ"])
|
| 203 |
|
| 204 |
if not problem_option:
|
| 205 |
st.warning("ๅฐใชใใจใ1ใคใฎๅ้กใชใใทใงใณใ้ธๆใใฆใใ ใใใ")
|
| 206 |
else:
|
| 207 |
-
#
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
problem = f"{num1} {operator} {num2}"
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
generate_button = st.button("ๅ้ก็ๆ")
|
| 225 |
-
|
| 226 |
-
if generate_button:
|
| 227 |
init_problem = f"(x + {a})*(x + {b})"
|
| 228 |
expression = init_problem
|
| 229 |
if expression:
|
| 230 |
result = expand(expression)
|
| 231 |
-
st.success(f"
|
| 232 |
st.latex(result)
|
|
|
|
| 233 |
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
generate_button = st.button("ๅ้ก็ๆ")
|
| 240 |
-
|
| 241 |
-
if generate_button:
|
| 242 |
init_problem = f"(x + sqrt({abs(a)}))*(x - sqrt({abs(b)})) = 0"
|
| 243 |
expression = init_problem
|
| 244 |
if expression:
|
| 245 |
result = expand(expression)
|
| 246 |
-
st.success(f"
|
| 247 |
st.latex(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
st.error(f"ใจใฉใผ: {e}")
|
| 199 |
# ๅ้ก็ๆ
|
| 200 |
# ๅ้ก็ๆ
|
| 201 |
+
# ๅ้ก็ๆ
|
| 202 |
elif selected_function == "ๅ้ก็ๆ":
|
| 203 |
problem_option = st.radio("ๅ้กใชใใทใงใณใ้ธๆใใฆใใ ใใ:", ["ๅๅๆผ็ฎ", "ๅ ๆฐๅ่งฃ", "ๆน็จๅผ"])
|
| 204 |
|
| 205 |
if not problem_option:
|
| 206 |
st.warning("ๅฐใชใใจใ1ใคใฎๅ้กใชใใทใงใณใ้ธๆใใฆใใ ใใใ")
|
| 207 |
else:
|
| 208 |
+
# ไนฑๆฐใฎ็ๆ็ฏๅฒๆๅฎ
|
| 209 |
+
min_value = st.number_input("ไนฑๆฐใฎๆๅฐๅคใๅ
ฅๅใใฆใใ ใใ:", value=-10)
|
| 210 |
+
max_value = st.number_input("ไนฑๆฐใฎๆๅคงๅคใๅ
ฅๅใใฆใใ ใใ:", value=10)
|
| 211 |
+
|
| 212 |
+
# ็ๆใใฟใณ
|
| 213 |
+
generate_button = st.button("ๅ้กใ็ๆใใ")
|
| 214 |
+
|
| 215 |
+
if generate_button:
|
| 216 |
+
generated_problems = []
|
| 217 |
+
|
| 218 |
+
# ๅๅๆผ็ฎใฎๅ้ก็ๆ
|
| 219 |
+
if problem_option == "ๅๅๆผ็ฎ":
|
| 220 |
+
# ไพ: 3 + 5 * 2
|
| 221 |
+
num1 = random.randint(min_value, max_value)
|
| 222 |
+
num2 = random.randint(min_value, max_value)
|
| 223 |
+
operator = random.choice(["+", "-", "*", "/"])
|
| 224 |
problem = f"{num1} {operator} {num2}"
|
| 225 |
+
generated_problems.append(problem)
|
| 226 |
+
|
| 227 |
+
# ๅ ๆฐๅ่งฃใฎๅ้ก็ๆ
|
| 228 |
+
elif problem_option == "ๅ ๆฐๅ่งฃ":
|
| 229 |
+
# ไพ: x**2 + 5*x + 6
|
| 230 |
+
a = random.randint(min_value, max_value)
|
| 231 |
+
b = random.randint(min_value, max_value)
|
|
|
|
|
|
|
|
|
|
| 232 |
init_problem = f"(x + {a})*(x + {b})"
|
| 233 |
expression = init_problem
|
| 234 |
if expression:
|
| 235 |
result = expand(expression)
|
| 236 |
+
st.success(f"ๅ้ก: {result}")
|
| 237 |
st.latex(result)
|
| 238 |
+
generated_problems.append(result)
|
| 239 |
|
| 240 |
+
# ๆน็จๅผใฎๅ้ก็ๆ
|
| 241 |
+
elif problem_option == "ๆน็จๅผ":
|
| 242 |
+
# ไพ: (x + sqrt(5))*(x - sqrt(2)) = 0
|
| 243 |
+
a = random.randint(min_value, max_value)
|
| 244 |
+
b = random.randint(min_value, max_value)
|
|
|
|
|
|
|
|
|
|
| 245 |
init_problem = f"(x + sqrt({abs(a)}))*(x - sqrt({abs(b)})) = 0"
|
| 246 |
expression = init_problem
|
| 247 |
if expression:
|
| 248 |
result = expand(expression)
|
| 249 |
+
st.success(f"ๅฑ้็ตๆ: {result}")
|
| 250 |
st.latex(result)
|
| 251 |
+
generated_problems.append(result)
|
| 252 |
+
|
| 253 |
+
st.success("็ๆใใใๅ้ก:")
|
| 254 |
+
for idx, problem in enumerate(generated_problems, start=1):
|
| 255 |
+
st.write(f"{idx}. {problem}")
|