control

Python Variables and Data Types

Python Variables and Data Types

Variables store data values. Python supports multiple data types such as integers, strings, lists, and dictionaries.

Creating Variables

You can create variables simply by assigning values to them:

      
        name = "Alice"
        age = 25
        is_student = True
      
    

Data Types

Python has various built-in data types, including:

Activity

Try It Yourself!

Create variables for your favorite color, number, and whether you are a student, and print them out.

Quick Quiz

Quick Quiz

  1. What is a variable in Python?
  2. What are the basic data types in Python?

Answers: A variable stores a value. The basic data types are int, float, str, bool, list, and dict.