Adding questions and correct answers at the end of quiz ..
Browse filesThis is related to below request
https://huggingface.co./datasets/reasoning-course/certificates/discussions/2
here , we are also adding questions and correct answer at the end of quiz once user passes the exam ..
app.py
CHANGED
@@ -219,10 +219,18 @@ async def push_results_to_hub(
|
|
219 |
# Create LinkedIn button
|
220 |
linkedin_button = create_linkedin_button(profile.username, cert_url)
|
221 |
|
|
|
|
|
|
|
|
|
|
|
222 |
result_message = f"""
|
223 |
🎉 Congratulations! You passed with a score of {grade:.1%}!
|
224 |
|
225 |
{linkedin_button}
|
|
|
|
|
|
|
226 |
"""
|
227 |
|
228 |
return (
|
@@ -349,7 +357,7 @@ Upon completion of {EXAM_MAX_QUESTIONS} questions, you can collect and share you
|
|
349 |
## Instructions
|
350 |
1. Log in then click 'Start' to begin.
|
351 |
2. Answer each question and click 'Next'
|
352 |
-
3. Click 'Claim your
|
353 |
|
354 |
## Questions:
|
355 |
""")
|
|
|
219 |
# Create LinkedIn button
|
220 |
linkedin_button = create_linkedin_button(profile.username, cert_url)
|
221 |
|
222 |
+
# Collect the questions and correct answers
|
223 |
+
questions_and_answers = "\n\n".join(
|
224 |
+
[f"**Q:** {ans['question']}\n**A:** {ans['correct_answer']}" for ans in user_answers]
|
225 |
+
)
|
226 |
+
|
227 |
result_message = f"""
|
228 |
🎉 Congratulations! You passed with a score of {grade:.1%}!
|
229 |
|
230 |
{linkedin_button}
|
231 |
+
|
232 |
+
## Here are the questions and correct answers:
|
233 |
+
{questions_and_answers}
|
234 |
"""
|
235 |
|
236 |
return (
|
|
|
357 |
## Instructions
|
358 |
1. Log in then click 'Start' to begin.
|
359 |
2. Answer each question and click 'Next'
|
360 |
+
3. Click 'Claim your certificate' to get a certificate and share it with the world! 🌍"
|
361 |
|
362 |
## Questions:
|
363 |
""")
|