Variables in Python

Lesson 8/20 | Study Time: 5 Min
      • A variable can be considered as a storage container for data.
      • Every variable will have a name.
      • It is a good way to store information while making it easy to refer to that information in our code later.
image.png

For instance, instead of working with the number 3.14, we can assign it to a variable pi and use it as many times as we want in our code (wherever required).
The equal sign (=) is used to assign values to variables.
The syntax for assigning values to a variable is as follows: Variable name = value or information.

Example:
x = 5
y = "John"

GDPR

When you visit any of our websites, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and manage your preferences. Please note, that blocking some types of cookies may impact your experience of the site and the services we are able to offer.