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

12y 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?

Python was named by its creator, Guido van Rossum, after the British comedy series "Monty Python's Flying Circus." Guido wanted a name that was short, unique, and somewhat mysterious—something that would be memorable and not overly serious. The name "Python" has no connection to the snake; instead, it reflects the fun and accessible nature of the language itself, as Guido was a fan of the comedy show's humor and creativity. At CNC WEB WORLD in Nerul, Mumbai, we offer a complete Python course to help you dive into this powerful programming language. With our 100% job placement support and dedicated instructors, you’ll gain not only technical expertise but also industry readiness. Join us to start your Python journey today!


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).


What Rules of naming convention?

Naming conventions refer to guidelines for naming variables, functions, classes, etc. in code. It's important for consistency and readability. Some common rules include using descriptive names, avoiding abbreviations, using camelCase or snake_case depending on the language, and following any specific conventions set by the language or framework being used.


Are there variables in exponents?

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