<b>First:</b> Python keywords are very basic at the stage of learning this scripting language. These are most commonly and frequently used while coding.
Purpose of each keyword is known clearly while applying it in programming.
and lambda not
assert continue or
break for pass
class yield print
finally global except
del if with
while import try
elif in def
else is return
raise exec from
<b>Second:</b> Indentation is really interesting thing in python. This is optional and nice to have indented code blocks in other programming languages.
Whereas in python this is mandatory, otherwise the program execution is failed. At various steps indentation is required like after conditional statements, functions, modules etc. Error condition triggered without indentation is shown below.
>>> if x > y:
... print "x is greater"
File "<stdin>", line 2
print "x is greater"
^
IndentationError: expected an indented block
<b>Third:</b> String assignment is done using "equal to" or = operator. But the string text is defined in single, double and triple quotes. One example can give a better picture.
>>> x = 'python'
>>> y = "Python2"
>>> z = """Python3"""
>>> x
'python'
>>> y
'Python2'
>>> z
'Python3'
>>>
Subscribe to:
Post Comments (Atom)
Featured Post
Introduction To Groovy Programming
Starting with the first program printing "Hello World". There is no interactive shell available like other scripting langugages t...
-
Traditional data types includes strings, Numbers, lists or arrays but Python has two more distinct data types. Those are tuple and dictionar...
-
<b>First:</b> Python keywords are very basic at the stage of learning this scripting language. These are most commonly and frequ...
-
Similar to other scripting languages Python has got more support online from technical forums and strong base made it popular. It is easy to...
No comments:
Post a Comment