4.python Basic Syntax
4.python Basic Syntax
4.python Basic Syntax
--------------------
Example:1
---------
>>> print ("Hello Python")
Hello Python
>>>
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-
Example:2
---------
>>> a="Welcome To Python"
>>> print (a)
Welcome To Python
>>>
Explanation:
------------
1.Here,we are using IDLE to write the Python code.
5.Therefore "print a" statement will print the content of the variable.
1.Interactive Mode
2.Script Mode
3.Using IDLE
i)Using Interactive mode
ii)Using Script Mode
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--
Python Keywords:
----------------
*Python Keywords are special reserved words which convey a special meaning to
the compiler/interpreter.
*Each keyword have a special meaning and a specific operation.
True
False
None
and
as
asset
def
class
continue
break
else
finally
elif
del
except
global
for
if
from
import
raise
try
or
return
pass
nonlocal
in
not
is
lambda
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--
Identifiers:
------------
Identifiers are the names given to the fundamental building blocks in a program.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--
Python Comments:
----------------
In case user wants to specify a single line comment, then comment must start
with ?#?
Example:
Example:
''' This
Is
Multipleline comment'''
or
""" This
Is
Multipleline comment"""
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-