Identifiers
Lets take
looks on Identifiers and Operators mostly used in Python script.
Variable
names and Identifiers in Python are similar to those in many other languages
they will start with letter (A-Z or a-z) or an underscore(_). Their length is limited only by your
eagerness to type, and they are case-sensitive like kalgyan and Kalgyan are two different identifiers. Regardless of length, choose identifiers that
are meaningful.
Lets take simple valid and invalid Identifiers as example:
wordCount
y_axis
errorField2
_logFile
_2
# Technically valid, but not a good idea
7Index
# Invalid, starts with a number
won’t_work # Invalid due to
apostrophe character
There are few other identifier with special meaning
_name—Not imported by “from x import *”
__name__—System name
__name—Private class member
When we are
running the Python interpreter in interactive mode, a single underscore
character(__ is a special identifier that holds that result of the last
expression evaluated this especially handy when you are using Python as destop
calacuator:
>>>
“Hello”
‘Hello’
>>>
_
‘Hello’
>>>
5 + 2
7
>>>
_ * 2
14
>>>
_ + 5
19
>>>
Reserved Words in Pyhton
Let see some of the reserved key words which are used in
Pyhton script language used:
and
del
for is
raise
assert
elif from lambda return
break
else
global not try
class
except if or while
continue
exec import
pass
def finally in print
Operators
Now we will some of the Oprators which all are used in
Python script:
- != %
& * ** / ^ | ~
+ < <<
<= <> == > >=
>>
0 Comments