Trivia TerminalGame with Python please review thanks!

Hello, I did a trial of terminal game with some trivia, please let me know how it is and how can improve!!!

Thanks in advance!


here the link to GitHub!!!

Rather than three parallel data structures, perhaps roll those three elements into a single object?

Placing the letters in the options limits your flexibility. You can add those letters in on display. Indeed, if you identify the correct option, you can go on to shuffle them for a little more fun.

Thanks!!! I will try to do that! sounds dificult but i will try hehe!!!

So, I’d start like:

# all your questions answers
qa_list = [
    ("Where can you dine on a 100-year-old egg?",("A. Russia", "B. Finland", "C. China", "D. Estonia"),"C")
    # ...
# ...
# pick one to test and decon the three moving parts
question, options, correct_answer = qa_list[0] 
print(question, "\n")
for option in options:

Next, for the shuffle letter thing:

import random
# all your questions answers
# first one is always the answer
qa_list = [
    ("Where can you dine on a 100-year-old egg?",("China", "Russia", "Finland",  "Estonia"))
    # ...

question, options = qa_list[0] 
correct_answer = options[0]
display_options = list(options) # copy them, want a list
random.shuffle(display_options) # shuffle that list

print(question, "\n")
# enumerate is a clever little function, it tacks an index onto the value
for option_num, option in enumerate(display_options):
    letter = chr(ord('A') + option_num) # want to turn the number into a letter
    print(letter, option)
    # turn it back with
    # pick = ord(letter[0].upper()) - ord('A')

Anyway, something to play with. Have fun.

Wow! Thanks so much!!! now is so clear hehe