Python Syntax
what you’ll learn:
• Python Identifiers
• Execute Python Syntax
• Python Indentation
• Python Variables
• Comments in Python
Python Identifiers
Identifiers in Python are user defined names to
represent variable, functions, class or any
object or module.
Execute Python Syntax
Python syntax can be executed by writing directly in
the Command Line or by creating a python file on the
server, using the .py file extension, and running it in
the Command Line
Python Indentation
In other programming languages the indentation
Indentation refers to the spaces at the in code is for readability only, the indentation in
beginning of a code line Python is very important.
Python uses indentation to indicate a block of
code.
Python will give you an error if you skip the
indentation
Python Variables
In Python, variables are created when you
assign a value to it
Python has no command for declaring a
variable.
Comments In Python
Comments can be single line or multi line.
Python has commenting capability for Single line comments are denoted by
the purpose of in-code documentation. ‘#’,and Python will render rest of the line
as a comment.
Multiline comments are denoted by ‘’’ or
“””.
Comments are non-executable
instructions/statements ignored by the
interpreter.
AUGMINTECH
Q1. Identifiers in Python is a name given to ___________?
(a) Variables (b) Functions
(c) Modules (d) All the Above
Ans: (d) All the above
AUGMINTECH
Q2. Comments in Python are written using ___________?
(a) # (b) ‘’’ ‘’’
(c) “”” “”” (d) All the Above
Ans: (d) All the above
AUGMINTECH
Q3. ___________ is a container to store the value
(a) Function (b) Variable
(c) Class (d) Comment
Ans: (b) Variable
AUGMINTECH
Q4. Python file is saved with ___________ extension.
(a) .py extension (b) .txt extension
(c) .python extension (d) None of the above
Ans: (a) .py extension