Python integer declaration | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Python integer declaration

How to declare an identifier as type integer ?

2nd Jan 2019, 6:56 AM
Abdelkader Barraj عبد القادر البراج
Abdelkader Barraj عبد القادر البراج - avatar
2 Answers
+ 3
Python is dynamically typed, which means that you don't have to declare what type each variable is. To assign the value 3 to the variable “num” just do: num = 3
2nd Jan 2019, 7:06 AM
Diego
Diego - avatar
+ 3
And it converts type for you too. Try in code playground : print(4/2) becomes a float
2nd Jan 2019, 7:15 AM
Gordon
Gordon - avatar