Help regarding tweaks needed in my code to make a quiz, please! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Help regarding tweaks needed in my code to make a quiz, please!

I'd like to try and create my own quiz but struggling since trying to use what I had found on YouTube. Any advice please? I'm only a beginner. https://code.sololearn.com/cPLbngwpV387/?ref=app

23rd Nov 2019, 12:08 PM
Kerrin Tarr
Kerrin Tarr - avatar
15 Answers
+ 3
Kerrin Tarr Could you share your code please
23rd Nov 2019, 12:33 PM
Dilji
Dilji - avatar
+ 3
Elizaveta Davidenko Without any reason why this type of emoji in this thread.
24th Nov 2019, 9:55 PM
A͢J
A͢J - avatar
+ 2
😝
24th Nov 2019, 5:16 PM
Elizaveta Davidenko
Elizaveta Davidenko - avatar
+ 2
and what not? boo boo boo
24th Nov 2019, 10:02 PM
Elizaveta Davidenko
Elizaveta Davidenko - avatar
+ 2
I'll know
24th Nov 2019, 10:13 PM
Elizaveta Davidenko
Elizaveta Davidenko - avatar
+ 1
Problems with SoloLearn compiler is that it requires you to input everything before the codes are thrown back to server for compilation, thus eliminating interactivity which is an essential feature of any program; except for Web Code, which are compiled locally. See the Simple MC Quiz demo series provided by everything.js https://www.sololearn.com/post/131295/?ref=app https://code.sololearn.com/WKKkpq0efxai/?ref=app
23rd Nov 2019, 1:27 PM
Gordon
Gordon - avatar
+ 1
Updated Code: https://code.sololearn.com/clFcbbsprlIL/?ref=app the format of input is provided in the below screenshot : https://ibb.co/JBvWytN
23rd Nov 2019, 1:30 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
Kerrin Tarr Please move the code link from question title into the Description section. Links in question title or tags doesn't work.
23rd Nov 2019, 2:18 PM
Ipang
23rd Nov 2019, 2:21 PM
Kerrin Tarr
Kerrin Tarr - avatar
+ 1
Kerrin Tarr Sorry, I think you misunderstood me, perhaps I was not clear 😁 I meant to say please edit your original question (above, top most) to move the link from question title into the Description section (still in your original question). This is so thread visitors will see and can access the code immediately as they open this thread.
23rd Nov 2019, 2:28 PM
Ipang
+ 1
My bad, sorry 😁 I've edited it, thank you.
23rd Nov 2019, 5:49 PM
Kerrin Tarr
Kerrin Tarr - avatar
+ 1
Big Thanks for understanding Kerrin Tarr 👍
23rd Nov 2019, 6:07 PM
Ipang
+ 1
Many thanks Sami Khan! Just worked out what you meant by the screenshot 😅
23rd Nov 2019, 7:05 PM
Kerrin Tarr
Kerrin Tarr - avatar
+ 1
Elizaveta Davidenko Here you can give only answer if you know.
24th Nov 2019, 10:09 PM
A͢J
A͢J - avatar
0
class Question: def__init__(self, prompt, answer): self.prompt = prompt self.answer = answer question_prompts = [ "Which country's capital is Lisbon?\n(a) Spain\n(b) Portugal\n(c) Germany\n(d) Andorra\n\n", "What is the square root of 121?\n(a) 7\n(b) 9\n(c) 11\n(d) 13", "Who was the UK Prime Minister before Boris Johnson?\n(a) Gordon Brown\n(b) David Cameron\n(c) John Major\n(d) Theresa May" ] questions = [ Question(question_prompts [0], "b"), Question(question_prompts [1], "c"), Question(question_prompts [2], "d") ] def run_test(questions): score = 0 for Question in questions: answer = input(question.prompt) if answer == question.answer: score +=1 print("You Scored" + "str(score)" + "/" + str(len(questions)) + "Correct!") run_test(questions)
23rd Nov 2019, 12:51 PM
Kerrin Tarr
Kerrin Tarr - avatar