Python Basics Quiz

  • Questions: 20
  • Easy
  • Pass mark: 70%

How well do you know the basics of Python? This free quiz has 20 short questions for beginners, from print() and f-strings to lists, dictionaries, loops and functions. Most of them show a few lines of code and ask what it does, the way you will read code every day.

What the quiz covers

  • Comments, print() with sep and end, f-strings
  • Variable names, data types and type conversion
  • Arithmetic: //, %, ** and operator precedence
  • Strings: indexing, slicing and string methods
  • Conditions: if, elif, else and truthy values
  • Lists, tuples, dictionaries and sets
  • Loops with range(), break and continue
  • Functions: default values, keyword arguments, returning several values and variable scope

How it works

  • 20 questions: 15 with one correct answer, 5 where you select every correct answer
  • After each question you see the correct answer and a short explanation
  • No time limit and no account needed
  • Score 70% or more (14 of 20) to pass

Every topic has a runnable program on the Python examples page. Change the code and run it in the online Python editor to see why an answer is right.

Log in to save this result to your progress. Log in

Next up: Base 6 Number System in Python →