What are Variables in python?
In Python, variables are used to store values. Variables are also known as Identifiers.
Let's how to create or assign a variable in python programming
language.
How to assign a variable in python?
Python is a type infer language, which means we don't have to specify the
type of variable in Python. Let's see how to assign a variable in python
Let's say we have a variable x which have value, 200. Now to assign this we firstly have to write x in command line or
code editor. Put equals sign = next to x. After that write the value
of x.
For example:-
x=200
Congrats you learned you how to assign a variable. Now see some rules that
you should follow while assigning a variable.
Different ways for assigning a variable.
There are so many ways for assigning a variable in python.
Normal way of assigning a variable is discussed above.
Assigning Same value with different variables.
a = b = 1
Assigning Different values with different variables in same line.
a, b = 2, 3
Rules for assigning a variable
In python programming language, variable name doesn't contain any number,
also any symbol like '+', '-' etc. You may include capital and small
alphabets in variable name.
For example:-
LearnPython = "techwithpie"
0 Comments