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 Réponses
+ 5
i think you could get the answer faster trying it by yourself in the code section of sololearn :p anyway, you can write x=10 without declaring the type -using python
29th Jan 2017, 4:04 PM
Daniele Daini
Daniele Daini - avatar
+ 1
thank you
2nd Feb 2017, 12:16 AM
deejae
deejae - avatar