Kids Coding

Project: Quiz

Ask three questions. Keep a score. Print how you did.

KidsIntermediateProject: Quiz

Three questions, one score

Keep score in a box. For each question, check the answer. Add 1 when it is right. Print the total at the end.

A three-question quiz

score = 0

q1 = "blue"
if q1 == "blue":
    print("1. Yes")
    score = score + 1
else:
    print("1. No")

q2 = "4"
if q2 == "4":
    print("2. Yes")
    score = score + 1
else:
    print("2. No")

q3 = "fox"
if q3 == "fox":
    print("3. Yes")
    score = score + 1
else:
    print("3. No")

print("Score:", score, "out of 3")

Keep the questions and answers in a list, then loop over them. Ten questions become the same few lines as one.

Make it yours

  • Change the questions.
  • Use a list of answers later if you want less copy-paste.
  • On a computer, each q can be input(...).

Real life

A three-question animal quiz in science class.

Each right answer adds a mark. score = score + 1 is the tick on the paper.

Science quiz

score = 0
if "whale" == "whale":
    score = score + 1
if "insect" == "spider":
    score = score + 1
else:
    print("Spiders are not insects")
print("Marks:", score, "/ 2")

Change one word. Run it. That is how this idea shows up outside the lesson.

Try it

Exercise 1: One question: if answer is 2, add a point and print Score: 1.

Show solution
score = 0
answer = "2"
if answer == "2":
    score = score + 1
print("Score:", score)

FAQ: Project: Quiz

Common questions about this page.

What is StudyGrid Kids?

StudyGrid Kids is a free coding path for children: Basic, Intermediate, and Advanced. Lessons use Python in the browser. No account and no install.

Should I run project: quiz examples locally for better learning?

Yes. Use the browser editor on StudyGrid for a quick check, then Download the example and run it on your computer. Local runs show real errors and the real toolchain, which is one of the fastest ways to learn project: quiz in this Kids Coding Python lesson (Project: Quiz).

Which kids level should we start with?

Start at Basic if the child has never written code. Choose Intermediate if they can print, use variables, and write a simple if. Choose Advanced if they already use loops and lists.

Do kids need an account or an app?

No. Kids pages are public. Code runs in the Try Python editor at /try. We do not ask children for a name or an email.

What language do kids learn?

Python, with a first HTML page in Intermediate and Advanced. After Advanced, the main Python tutorial is the next step.

Is the kids coding track free?

Yes. The Kids home, the three levels, and the Python editor on StudyGrid (studygrid.in) are free.