Python 3 variable Initialization | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python 3 variable Initialization

I am starting the Python3 course here. I just wanted to know in Python are you required to initialize your variables with a type as soon as you create them like in C++ and Java? For ex. I know on C++ I can't write x= 10; w/o specifying whether x is type int, float, or double. I would have to write int x= 10; do we have the same requirement in Python or can we just write x= 10 and go about our business w/o stating a type for x?

29th Jan 2017, 3:27 PM
deejae
deejae - avatar
2 Answers
+ 1
Python... name="Justin" age=15 Java... String name = "Justin"; int age = 15; you do not have to initialize in Python
30th Jan 2017, 1:21 AM
LordHill
LordHill - avatar
0
thank you
2nd Feb 2017, 12:16 AM
deejae
deejae - avatar