Wednesday, April 22, 2020

Rules in Declaring a Variable in Python

Rules in Declaring a Variable in Python

To declare a variable its identifier, you need to know what data type it is going to be of and what its name would be. The variable name has constraints on what you can name it. The following are the rules for naming variables:

must begin with a letter (a - z; A - B) or underscore (_)
other characters can be letters, numbers, or _
Variable names are case-sensitive. For example, computer and Computer are different.
can be any (reasonable) length
There are some reserved words, which you cannot use as a variable name because Python uses them for other things.
The variable should not start with a number.

Also, follow these guidelines while naming a variable, as having a consistent naming convention helps in avoiding confusion and can reduce programming errors.

Python variables use lowercase letters with words separated by underscores as
necessary to improve readability, like this: whats_up and how_are_you. Although this is not strictly enforced, it is considered a best practice to adhere to this convention.
Avoid naming a variable where the first character is an underscore. While this
is legal in Python, it can limit the interoperability of your code with applications
built by using other programming languages.
Ensure variable names are descriptive and clear enough. This allows other programmers to have an idea about what the variable is representing.


Here are some examples of acceptable variable names:
username a xyz123 J_1978
_temp Myname88 retval qty_price
aDDress ID_Num midterm_grade wage_emp

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, IT projects, school and application development, programming projects, thesis, and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.unlimitedbooksph.com/


No comments:

Post a Comment