Python Variables Quiz

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

Variables are the first thing you meet in Python, and they come back in every program. This free quiz has 15 short questions for beginners: how to create and name a variable, what happens when you assign one variable to another, which data type a value has, how to convert between types and when a function can change a variable outside it.

What the quiz covers

  • Creating variables and the rules for their names
  • Reassigning, copying a value and swapping two variables
  • Shortcuts such as += and *=
  • Data types: int, float, str and bool
  • Type conversion with int() and dynamic typing
  • Constants by convention and the global keyword

How it works

  • 15 questions: 11 with one correct answer, 4 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 (11 of 15) to pass

Each topic has a runnable example: creating variables, basic data types, type conversion, dynamic typing and local and global variables. After this one, try the Python print() Quiz or the Python Basics Quiz.