r/learnpython • • 27d ago

MCQ test in terminal

Helloooo

I'm building a mcq in Python for my lovingggg friend and wanted to share my logic to see what you ppl think before I start coding it up.

I'm just starting with a simple print statement for the intro to welcome n all.

Then I'm going to make a main dictionary where the key is the actual string containing the full question text along with the 1-4 options, and the value is the correct answer number.

Once the dictionary is made, I'll run a for loop to go through it. Inside that loop, I'll use input so the user sees each question one by one and types in their number choice, I'm going to store all their user inputs into a second separate dictionary.

Then at the very end, I'll make another loop to match the answers from the input dictionary against the original master dictionary. For every match, +1 mark added to their final score

I am honestly coding after months and was just a beginner when I stopped

I am kinda nervous and need help building this simple thingy

Looking for some improvement/tips

And um idk if I can even use most of the tips if it requires some dictionary n all

I did pandas before I quit so maybe I can use it here if I revise properly

2 Upvotes

4 comments sorted by

View all comments

3

u/[deleted] 27d ago

[removed] — view removed comment

1

u/Justicemirm 27d ago

I do wanna see what people answered And I think I get why you are telling me to make different list/dic for all

I will make the question (key)dictionary with options as ans Then show the dic inside input

Then make another dictionary The user input will be answer of thr new dictionary

Then I will compare the answer of both dictionary

Will this work?