Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -69,14 +69,14 @@ def main():
|
|
| 69 |
st.markdown("<h2 style='color: #707379;'>Coding Challenge - Code Practice</h2>", unsafe_allow_html=True)
|
| 70 |
|
| 71 |
# Description of the challenge
|
| 72 |
-
st.write("Create a function
|
| 73 |
st.write('''sass''')
|
| 74 |
|
| 75 |
-
func =
|
| 76 |
def execute_instructor_code(params):
|
| 77 |
# Execute the instructor's code to get the result
|
| 78 |
globals_dict = {}
|
| 79 |
-
exec('''def
|
| 80 |
return a+b''', globals_dict)
|
| 81 |
instructor_function = globals_dict.get(func)
|
| 82 |
|
|
@@ -90,24 +90,24 @@ def main():
|
|
| 90 |
sample_examples = "\n".join([f"{func}({', '.join(map(str, params))}) -> {execute_instructor_code(params)}" for params in test_cases])
|
| 91 |
show_solution_button = st.form_submit_button("Show Solution")
|
| 92 |
if show_solution_button:
|
| 93 |
-
solution = '''def
|
| 94 |
return a+b'''
|
| 95 |
if solution:
|
| 96 |
-
st.code('''def
|
| 97 |
return a+b''', language="python")
|
| 98 |
else:
|
| 99 |
st.error('No Solution Provided!')
|
| 100 |
|
| 101 |
# Code input area
|
| 102 |
-
code = st_ace(value='''def
|
| 103 |
# Check solution button
|
| 104 |
if st.form_submit_button("Check Solution"):
|
| 105 |
if code:
|
| 106 |
# Check the solution
|
| 107 |
-
check_solution('''def
|
| 108 |
return a+b''',
|
| 109 |
code,
|
| 110 |
-
'''
|
| 111 |
'''[(1, 2), (2, 3), (3, 4)]'''
|
| 112 |
)
|
| 113 |
else:
|
|
|
|
| 69 |
st.markdown("<h2 style='color: #707379;'>Coding Challenge - Code Practice</h2>", unsafe_allow_html=True)
|
| 70 |
|
| 71 |
# Description of the challenge
|
| 72 |
+
st.write("Create a function sum that meets the following criteria:")
|
| 73 |
st.write('''sass''')
|
| 74 |
|
| 75 |
+
func = 'sum'
|
| 76 |
def execute_instructor_code(params):
|
| 77 |
# Execute the instructor's code to get the result
|
| 78 |
globals_dict = {}
|
| 79 |
+
exec('''def sum(a,b):
|
| 80 |
return a+b''', globals_dict)
|
| 81 |
instructor_function = globals_dict.get(func)
|
| 82 |
|
|
|
|
| 90 |
sample_examples = "\n".join([f"{func}({', '.join(map(str, params))}) -> {execute_instructor_code(params)}" for params in test_cases])
|
| 91 |
show_solution_button = st.form_submit_button("Show Solution")
|
| 92 |
if show_solution_button:
|
| 93 |
+
solution = '''def sum(a,b):
|
| 94 |
return a+b'''
|
| 95 |
if solution:
|
| 96 |
+
st.code('''def sum(a,b):
|
| 97 |
return a+b''', language="python")
|
| 98 |
else:
|
| 99 |
st.error('No Solution Provided!')
|
| 100 |
|
| 101 |
# Code input area
|
| 102 |
+
code = st_ace(value='''def sum(a,b):''', language="python", key="my_editor", theme='clouds', height=200)
|
| 103 |
# Check solution button
|
| 104 |
if st.form_submit_button("Check Solution"):
|
| 105 |
if code:
|
| 106 |
# Check the solution
|
| 107 |
+
check_solution('''def sum(a,b):
|
| 108 |
return a+b''',
|
| 109 |
code,
|
| 110 |
+
'''sum''',
|
| 111 |
'''[(1, 2), (2, 3), (3, 4)]'''
|
| 112 |
)
|
| 113 |
else:
|