Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -61,32 +61,31 @@ def main():
|
|
| 61 |
st.markdown("<h2 style='color: #707379;'>Coding Challenge - Code Practice</h2>", unsafe_allow_html=True)
|
| 62 |
|
| 63 |
# Description of the challenge
|
| 64 |
-
st.write("Create a function
|
| 65 |
-
st.write('''Create function to
|
| 66 |
|
| 67 |
# Display sample example for all test cases
|
| 68 |
-
sample_examples = "\n".join([f"
|
| 69 |
st.code(sample_examples, language="python")
|
| 70 |
show_solution_button = st.form_submit_button("Show Solution")
|
| 71 |
if show_solution_button:
|
| 72 |
-
solution = '''def
|
| 73 |
-
return a
|
| 74 |
if solution:
|
| 75 |
-
st.code('''def
|
| 76 |
-
return a
|
| 77 |
else:
|
| 78 |
st.error('No Solution Provided!')
|
| 79 |
|
| 80 |
# Code input area
|
| 81 |
-
code = st_ace(value='''def
|
| 82 |
-
''', language="python", key="my_editor", theme='clouds', height=200)
|
| 83 |
# Check solution button
|
| 84 |
if st.form_submit_button("Check Solution"):
|
| 85 |
if code:
|
| 86 |
# Check the solution
|
| 87 |
check_solution(code, {
|
| 88 |
-
"function_name": "
|
| 89 |
-
"test_cases": [((1, 2),
|
| 90 |
})
|
| 91 |
else:
|
| 92 |
st.error("Please provide a solution.")
|
|
|
|
| 61 |
st.markdown("<h2 style='color: #707379;'>Coding Challenge - Code Practice</h2>", unsafe_allow_html=True)
|
| 62 |
|
| 63 |
# Description of the challenge
|
| 64 |
+
st.write("Create a function multiply that meets the following criteria:")
|
| 65 |
+
st.write('''Create a function to multiply two integers''')
|
| 66 |
|
| 67 |
# Display sample example for all test cases
|
| 68 |
+
sample_examples = "\n".join([f"multiply({params}) -> {expected_output}" for params, expected_output in [((1, 2), 2), ((2, 2), 4), ((100, 2), 200)]])
|
| 69 |
st.code(sample_examples, language="python")
|
| 70 |
show_solution_button = st.form_submit_button("Show Solution")
|
| 71 |
if show_solution_button:
|
| 72 |
+
solution = '''def multiply(a,b):
|
| 73 |
+
return a*b'''
|
| 74 |
if solution:
|
| 75 |
+
st.code('''def multiply(a,b):
|
| 76 |
+
return a*b''', language="python")
|
| 77 |
else:
|
| 78 |
st.error('No Solution Provided!')
|
| 79 |
|
| 80 |
# Code input area
|
| 81 |
+
code = st_ace(value='''def multiply(a,b):''', language="python", key="my_editor", theme='clouds', height=200)
|
|
|
|
| 82 |
# Check solution button
|
| 83 |
if st.form_submit_button("Check Solution"):
|
| 84 |
if code:
|
| 85 |
# Check the solution
|
| 86 |
check_solution(code, {
|
| 87 |
+
"function_name": "multiply",
|
| 88 |
+
"test_cases": [((1, 2), 2), ((2, 2), 4), ((100, 2), 200)]
|
| 89 |
})
|
| 90 |
else:
|
| 91 |
st.error("Please provide a solution.")
|