You are viewing a single comment's thread from:

RE: What is a variable in Python?

in #python7 years ago

This is a good article, but since you're using the python tag, you should use Python conventions in your code examples. It would also help to explain the difference between the numeric types.

For example, Circle_Area should be circle_area, as it's more pythonic to use lower case for variable naming. Also, current_Lad should be current_lad. Combining snake and camel case is not good pythonista practice. Snake case is the Python norm.

As for the variable types:

Python supports four different numeric variable types: int, long, float, and complex

An example of each is below:
int - 10
long - 086498263L
float - 3.14159
complex - 2e+24J

Variables are distinguished by the Python run-time by how they look. All the variables above have something that gives them a unique identity, such as the "L" in the long variable, and the decimal in the float.

Strings are declared by just surrounding text in double quotes:
my_first_string = "this is a string"

there are other variable types and much more potential detail to dive into, but I intended this response to just be a gist of constructive tips.

That's about it! Great article! I don't mean any of this to sound negative in any way! I am merely a Python enthusiast who wanted to offer a few points of constructive criticism.

Have a great day and I wish you luck with writing your programming tutorials!

Sort:  

I haven't taken Python for a while so your comments were highly appreciated, it was a great refresher as I haven't taken Python for a while. I may do an intro article and strat c++ as that is what I am currently doing. Thank you for your input: ) ,