Is the Variables considered equivalent to a Class like in C#? is it the same meaning?
I'm a new lad keen to learn but I just wanted to make sure as I learn things, I want to get to know what I'm learning completely before moving onto the next thing to what I'm being taught.
- Richard Butterton
A newbie question about Python Variables
Post a Reply
|Oldest Newest Rating|
· July 6, 2015
No, a class in C++ would be equivalent to a class in Python!
A variable in python would be like this, for example: An integer called points which holds 500.
In python, you do not need to specify the data type, python does it for you
· August 8, 2015
Thanks for the kind responses, I kept checking Google Mail for a notification instead of checking here ;3 I've gotten a better understanding to it now thank you again. Though I've decided in the end to go for C# but really glad this community is friendly ;3
Otto Von Chesterfield
· July 7, 2015
To elaborate on alex constantin's explanation, Python variables are what as known as "dynamically enforced", meaning that, in general, programs don't really care what type of object something is, be it string or int, as long as it can get the job done the program wants it to do. For example:
The above code can work not just for numbers, but for strings too - in fact, any object that has the .__add__ method.
This is only part of the beauty of working in Python.
This section is all about snakes! Just kidding.
|Bucky Roberts Administrator|