Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| # ------------------------------- | |
| # اسڪول ۽ ڊولپر معلومات | |
| # ------------------------------- | |
| TITLE = "🧮 جماعت 6 رياضي ٽيسٽ" | |
| DEVELOPERS = "تيار ڪندڙ: Mr M Hasaan Mahar ۽ Atika Mahar" | |
| SCHOOL = "Smart School Larkana" | |
| # 20 رياضي سوال | |
| questions = [ | |
| {"question": "1. 7 + 5 ڪيترو ٿيندو؟", "options": ["10", "12", "13", "14"], "answer": "12"}, | |
| {"question": "2. 15 - 9 ڪيترو ٿيندو؟", "options": ["5", "6", "7", "8"], "answer": "6"}, | |
| {"question": "3. 8 × 6 ڪيترو ٿيندو؟", "options": ["42", "48", "56", "36"], "answer": "48"}, | |
| {"question": "4. 36 ÷ 6 ڪيترو ٿيندو؟", "options": ["5", "6", "7", "8"], "answer": "6"}, | |
| {"question": "5. 9 × 9 ڪيترو ٿيندو؟", "options": ["72", "81", "99", "89"], "answer": "81"}, | |
| {"question": "6. 100 - 45 ڪيترو ٿيندو؟", "options": ["45", "55", "65", "50"], "answer": "55"}, | |
| {"question": "7. 11 + 13 ڪيترو ٿيندو؟", "options": ["22", "24", "25", "23"], "answer": "24"}, | |
| {"question": "8. 50 ÷ 5 ڪيترو ٿيندو؟", "options": ["5", "10", "15", "20"], "answer": "10"}, | |
| {"question": "9. 14 × 2 ڪيترو ٿيندو؟", "options": ["26", "28", "30", "24"], "answer": "28"}, | |
| {"question": "10. 81 ÷ 9 ڪيترو ٿيندو؟", "options": ["8", "9", "7", "6"], "answer": "9"}, | |
| {"question": "11. 25 + 75 ڪيترو ٿيندو؟", "options": ["90", "100", "110", "95"], "answer": "100"}, | |
| {"question": "12. 60 - 25 ڪيترو ٿيندو؟", "options": ["30", "35", "40", "45"], "answer": "35"}, | |
| {"question": "13. 13 × 3 ڪيترو ٿيندو؟", "options": ["36", "39", "42", "33"], "answer": "39"}, | |
| {"question": "14. 72 ÷ 8 ڪيترو ٿيندو؟", "options": ["8", "9", "7", "6"], "answer": "9"}, | |
| {"question": "15. 19 + 21 ڪيترو ٿيندو؟", "options": ["40", "41", "39", "42"], "answer": "40"}, | |
| {"question": "16. 90 - 30 ڪيترو ٿيندو؟", "options": ["50", "60", "70", "80"], "answer": "60"}, | |
| {"question": "17. 6 × 7 ڪيترو ٿيندو؟", "options": ["42", "36", "48", "40"], "answer": "42"}, | |
| {"question": "18. 64 ÷ 8 ڪيترو ٿيندو؟", "options": ["6", "7", "8", "9"], "answer": "8"}, | |
| {"question": "19. 45 + 15 ڪيترو ٿيندو؟", "options": ["55", "60", "65", "50"], "answer": "60"}, | |
| {"question": "20. 100 ÷ 4 ڪيترو ٿيندو؟", "options": ["20", "30", "25", "40"], "answer": "25"}, | |
| ] | |
| def calculate_score(*answers): | |
| score = 0 | |
| for user_answer, question in zip(answers, questions): | |
| if user_answer == question["answer"]: | |
| score += 1 | |
| percentage = (score / 20) * 100 | |
| if percentage >= 50: | |
| status = "✅ پاس" | |
| else: | |
| status = "❌ فيل" | |
| return f""" | |
| 📊 نتيجو | |
| مارڪون: {score} / 20 | |
| فيصد: {percentage:.2f}% | |
| حيثيت: {status} | |
| {DEVELOPERS} | |
| {SCHOOL} | |
| """ | |
| with gr.Blocks() as app: | |
| gr.Markdown(f"# {TITLE}") | |
| gr.Markdown(f"### {SCHOOL}") | |
| gr.Markdown(f"**{DEVELOPERS}**") | |
| gr.Markdown("سڀئي سوال حل ڪريو ۽ پوءِ Submit Test تي ڪلڪ ڪريو.") | |
| answer_components = [] | |
| for q in questions: | |
| radio = gr.Radio(choices=q["options"], label=q["question"]) | |
| answer_components.append(radio) | |
| submit_button = gr.Button("ٽيسٽ جمع ڪريو") | |
| result = gr.Textbox(label="نتيجو") | |
| submit_button.click( | |
| calculate_score, | |
| inputs=answer_components, | |
| outputs=result | |
| ) | |
| app.launch() |