declaration of variables in Python

python is dynamic programming language.
so, it is very simple and easy to declare variable in Python.

you have to remember and type data types in static programming language such as C, C++ and JAVA. but it will be done with typing the name of variable in Python.

let's try to declare variables.

1
2
3
4
5
6
7
8
9
10
number = 1
string = "hello"
mList = [1,2,3,4]
mDict = {"name""jack""age"25}
 
print(number)
print(string)
print(mList)
print(mDict)
 
cs

I typed various typed variables such as string, number, list and dictionary like above.


the result is like above.

as you can see, in order to use variable in python, just type the variable name and assign any data to the variable.




Comments

Popular posts from this blog

making menubar and menu on QML

QSizePolicy Fixed example in pyside2

let's start QML programming with PySide2