Python Identifiers:Python identifier is a name used to identify a variable function, class, module, or other object.
Identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9).
Which it donot allow while declaring identifiersPunctuation characters such as @, $, and % within identifiers.
NotePython is a case sensitive programming language.
ExampleSCANFTREE and scanftree are two different words.
Some Notifiable Conventions used in decalring an identifier
- Class names start with an uppercase letter and all other identifiers with a lowercase letter.
- Starting an identifier with a single leading underscore indicates by convention that the identifier is meant to be private.
- Starting an identifier with two leading underscores indicates a strongly private identifier.
- If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.
Lines and Indentation
Ooh ! There is no braces while writing the code then you are wondering that how will you manage the blocks of code.
Solution is here blocks are denoted by line indentation
When you are writing a block then be careful about spaces before every line so that it appears in the same block. If it is.
if True: print "True" else: print "False"
Be careful from not following the wrong approach, as
if True: print "scanftree" print "True" else: print "scanftree" print "False"
whatever is written # followed by comment , is treated as comment
print 'sanftree.com' # this is a comment
In the next chapter you are going to learn some basic variables used in python