answersLogoWhite

0


Best Answer

A variable falls under the category of "Python identifier". SUch an identifier must start with a letter (uppercase or lowercase) or an underscore, followed by zero or more letters, underscores, and digits. Note that Python is case-sensitive; for example, myvariable, MyVariable, and MYVARIABLE would be treated as three different variables.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

There are no strict rules. Sometimes the first letter of the object represented by the variable is used eg m for mass, v for velocity. At other times, they are sequential letters of the alphabet, such as a, b, c or x, y, z. The variables may be letters from the Greek alphabet; they may be in upper case or lower case.

It is advisable not to use names which may be confused with numbers (depending on your handwriting). For various numbers, possible letters which may cash are:

0 and O

1 and I (upper case i) or l (lower case L)

2 and z

5 and S

6 and b

8 and B

9 and g (not very similar here but consider the letter as it is "normally" written.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the rules for naming variables in python?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are the naming rules in XML?

XML has no rules like html in regards to tags and naming tags, you write your own xml tags.


What is optional for python programming?

One optional part of python programming is the declaration of variables before use. In many languages, you must declare your variables before using them, but in python, you can simply set a variable equal to something and it will handle the type without your help.


Specify the naming convention for variable constant class and method?

The naming convention for variables, constants, classes, and methods involves delimiting separate words with a non-alphanumeric character such as a hyphen or underscore.


Why won't Python open on Windows 8?

Make sure you have the latest version of python downloaded.Run the fileSelect install for all users or install just for me, click NextYou'll see it installs under the C:\Python27 folder, click NextClick Next again for the 'Customize Python' stepClick FinishOpen Control Panel, then SystemClick 'Advanced system settings' on the leftClick the 'Environment Variables' buttonUnder 'System variables' click the variable called 'Path' then the 'Edit...' buttonWithout deleting any other text, add C:\Python27;(include the semi-colon) to the beginning of the 'Variable value' and click OK.Click OK on the 'Environment Variables' window.Restart your computer.Next when you open a command prompt window after the computer restarts and type python you will have python running in the command prompt.


Rules in naming variables in programming?

there are various types of naming rule provide for function ,identifier,i.e variables.but naming rule for variable must meet certain condition.. 1.you can easily idenfy what is variable for.for eg.you may use int a;/to store no of student in your prog. but it is better instead of using "a",you can write any of the following definition int stu; or int stu_no; or int studentno; 2.it must be abbreviated.because although modern compiler support 32 char variable but still where you use that variable you have to type that name again &again. so for eg. in the above case int stu_no; is optimal. when these precondition are met then here are some rules for naming a variable: 1.you use only English alphabet,numeric no,& _(underscore). 2.you must start with a alphabet. then you continue with alphabet or numeric or under score.for eg. you can define a variable like int stu_comp_2009;//for no of student 2009 batch. 3.no variable can start with number or _.such naming may cause some compiler do the right job but maximum would not support this.

Related questions

What are the rules for naming new elements?

The IUPAC rules for naming new chemical elements are at this link.


What are the naming rules on Microsoft Word 2007?

Upper & Lower case letters are the naming rules on Microsoft Word 2007.


What are the naming rules in XML?

XML has no rules like html in regards to tags and naming tags, you write your own xml tags.


What is optional for python programming?

One optional part of python programming is the declaration of variables before use. In many languages, you must declare your variables before using them, but in python, you can simply set a variable equal to something and it will handle the type without your help.


Who is faster Tiger or Burmese python?

well on land the tiger but in the water the python rules.


What are naming rules for Microsoft office word?

ribbons


Why is a python called a python?

The scripting programming language Python was named after the British comedy group Monty Python.


What is the generalizations of naming elements and how do you write the symbol of elements?

The rules for naming chemical elements and for chemical symbols are established by IUPAC; see this link.


A standardized system composed of methods rules and guidelines for naming atoms ions and compounds is known as?

A standardized system composed of methods rules and guidelines for naming atoms ions and compounds is known as chemical nomenclature


Why does carbon go first in CCl4?

It's just a naming convention. The rules of nomenclature were somewhat arbitrary at first. Then the need of standardization became apparent, and so formal naming rules came into play (sort of).


Are there variables in exponents?

In algebraic equations, exponents can contain variables. They can be solved for by using logarithmic rules for exponents.


What are the rules of naming and finding chemical formulas?

You need a book, not an answer here for that question.