Variable in Python

In this section we are going to learn how to represent variables in the Python language. Please note that variables in Python are dynamically typed, which means unlike languages like Java and C++, you don't need to specify whether the variable is a string, integer, etc.

There are some basic conveniences Python variables provide:

x = 100
y = 10
all, us , about = 10, 11 ,12
# In this case we have assigned variables at once
print(x+y) # This will print 110
print(us) # To see if it is going to print the us variable that we declared

Variable Naming Conventions

There are some naming variable conventions used in python language:

2cats = 10 #This is wrong
_cats = 10 #This is totally fine 
hey@hey = 10 # This is not good

cats != CATS
# In this case python language reads them differently

__dont_touch__ #Dunder Variable