Python by Swaroop C H - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Identifier Naming

Variables are examples of identifiers. Identifiers are names given to identify something. There are some rules you have to follow for naming identifiers:

 

• The first character of the identifier must be a letter of the alphabet (upper or lowercase) or an underscore ('_').

 

• The rest of the identifier name can consist of letters (upper or lowercase), underscores ('_') or digits (0-9).

• Identifier names are case-sensitive. For example,myname andmyName are not the same. Note the lowercasen in the former and the uppercaseN in te latter.
• Examples of valid identifier names arei,__my_name,name_23 anda1b2_c3.

• Examples of invalid identifier names are2things,this is spaced out andmy-name.