Create Python Variables

Use Python Variables, Create Python Variables

Use Python Variables

Memory of a variable computer contains the name of a location. This name is used to store value on that location and to get value from anywhere.

The value is stored mainly in any variable so that it can be performed or processed with it.Values ​​stored in variables can be of different types. Such as numbers, strings etc.

The print () function is used to print values ​​of variables in Python.

To print a text with a variable and print it using the + character in python. Apart from this, you can also add a variable from another variable to this variable.

Every variable in Python is an object. Actually in python, you do not assign a value to a variable, but instead you assign a reference to an object in which it is stored value.

This means that in python, when you try to access the value of a variable, you actually point out the object in which it is stored in value.

For example, look at the given code below.

num = 25

The code above has an integer object of 50 and num is a name that points to that object.

In Python you can not concatenate a string and number directly. First you declare both as separate variables, then those variables can be concatenated together.

Rules in Python Variables

Python has some variable related rules which are required to be followed.

1.You can not use Python’s reserved words as the variable names.
2.The name of a variable must start with either a letter or underscore (_) character.
3.The name of a variable can only be alphanumeric characters (a-z, 0-9 and _).