Variables in Python

In Python, a variable is a case-sensitive name that can hold a value. A variable can hold all kinds of values such as numbers, strings, etc. Below is an example of a variable storing a number.

1>>> price = 200
2>>> print(price)
3200
4

The above code creates a variable called price and assigns the integer value 200 to it. We can ask Python to tell us what is stored in the variable price using theprint statement and it will return the number 200.

Create Your Free Account

Create a free account to access this content and join our community of learners.

You'll get access to:

  • Access the full tutorial
  • Join our learning community
  • Track your progress
  • Bookmark content for later