Variables and Assignment

Variables are used to store information in Python. You assign a value to a variable using the = sign.

Creating Variables

x = 5
name = "Alice"

Changing Values

You can change the value of a variable at any time:

x = 10

Variable Names

  • Must start with a letter or underscore
  • Can contain letters, numbers, and underscores
  • Are case-sensitive (age and Age are different)

Practice creating and using variables in your code!

← Previous: Printing Text Next: Python Data Types →