Variables in Python
Variables are used for storing any data values.
Rules for naming a Variable
1.Variable name can be an alpha-numeric combination.
2.Variable name should not contain any special symbols except underscore( _ )
3.Variable name should always start with alphabets.
4.Variable names are case sensitive.
Example:
How to create variables in Python
Python does not have any command or structure to declare variables.
The Variable is created when it is first assigned with any value.
The output for the above code will be:
5
funda
Here, the variable "a" is of type int and the variable "user" is of type string.
You can check the datatype of a variable by using the type()
The output for the above code will be:
<class 'int'>
<class 'str'>
How to declare the string variables
The string variables can be declared within single quotes(' ') or double quotes(" ").
The output for the above code will be:
Funda of
web IT
Both the variables user1 and user2 is correct and will perform the same task.