Python Forum
Pointer in the right direction?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pointer in the right direction?
#4
A class is a good idea. Can also used lists, tuples or named tuples. This uses a list of tuples.
questions = [ \
    ("What is the capital of Colombia?", "Bogota"),
    ("What is the capital of Chile?", "Santiago")]

for question, answer in questions:
    # Ask the question
    ...
A nice thing about classes is you could do subclassing for different kinds of questions. They would share some basic methods like asking the question and verify the answer. You might have a fill in the blanks class, a T/F, a multiple choice, beat the buzzer type questions, etc. Each of these questions would know how to ask the question in the context of your quiz program and how to evaluate the answer. Eventually you could support questions that use multimedia.

As for typing questions into the program, that is something I would only do to at a very short while. Eventually you will want a way for your quiz program to import questions from some other resource. Maybe that will be a json file. Maybe a sql database. Maybe you will scrape questions from the internet. Maybe there is a network of quiz makers and they have a standard format and set of tools.
Reply


Messages In This Thread
Pointer in the right direction? - by Viking - Apr-21-2020, 07:57 PM
RE: Pointer in the right direction? - by deanhystad - Apr-21-2020, 08:00 PM
RE: Pointer in the right direction? - by Viking - Apr-21-2020, 08:24 PM
RE: Pointer in the right direction? - by deanhystad - Apr-21-2020, 08:47 PM
RE: Pointer in the right direction? - by snippsat - Apr-22-2020, 01:14 AM
RE: Pointer in the right direction? - by Viking - Apr-22-2020, 06:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Project Direction bclanton50 1 1,382 Jan-06-2022, 11:38 PM
Last Post: lucasbazan
Question How to understand the vector/direction mason321 0 1,164 Dec-14-2021, 10:57 PM
Last Post: mason321
  General pointer to start data4speed 3 2,046 Jul-01-2020, 06:18 AM
Last Post: DPaul
  Length and direction cosines of lines tarikrr 1 1,816 Nov-15-2019, 04:16 AM
Last Post: SheeppOSU
  Some direction needed Patriot1017 3 2,567 Sep-03-2019, 05:44 PM
Last Post: jefsummers
  Practicing using a "flag": please point in right direction magsloo 5 3,218 May-10-2019, 04:58 AM
Last Post: perfringo
  VM address (C pointer) of Python object Skaperen 1 2,104 Apr-21-2019, 10:57 PM
Last Post: hshivaraj
  trace invalid pointer simon149 7 5,269 Apr-16-2019, 07:05 AM
Last Post: simon149
  How to create a graph for direction visualization Visiting 2 2,844 Sep-22-2018, 10:49 PM
Last Post: Visiting
  Need tutorial/direction to access shared memory ridshack 2 3,084 Feb-22-2018, 11:24 PM
Last Post: ridshack

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020