epochs-demos commited on
Commit
d0fd73d
·
verified ·
1 Parent(s): 8629faa

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +10 -11
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 sum that meets the following criteria:")
65
- st.write('''Create function to get the sum of two integers.''')
66
 
67
  # Display sample example for all test cases
68
- sample_examples = "\n".join([f"sum({params}) -> {expected_output}" for params, expected_output in [((1, 2), 3)]])
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 sum(a,b):
73
- return a+b'''
74
  if solution:
75
- st.code('''def sum(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 sum(a,b):
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": "sum",
89
- "test_cases": [((1, 2), 3)]
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.")