Python Training Program: S V Ramanamurthy Senior Vice President Codetantra Tech Solutions Pvt. Ltd. Hyderabad
Python Training Program: S V Ramanamurthy Senior Vice President Codetantra Tech Solutions Pvt. Ltd. Hyderabad
Training Program
S V Ramanamurthy
Senior Vice President
CodeTantra Tech Solutions Pvt. Ltd.
Hyderabad
8years - Australia
13 years – Oman
Operators
Data types Data types
Statements
Computer
• Indentation is very important in python. Incorrect indentation leads to syntax and run
time errors. You cannot mix tabs and spaces for indentation in the same program.
06/13/2021 RVRJCE - Python - Day 1 17
Syntax and Grammar - Comments
• Single line Comments in Python begin with a hash mark ( # ) and continue
to the end of the line.
• # This is line comment
• a = b+5 # This is a partial line comment
• Multiple line comments in python are enclosed in triple quotes (‘’’ or “””).
“”” This is a
multiline
comment “””
• Because comments do not execute, when you run a program you will not
see any indication of the comments during runtime. Comments are in the
source code for humans to read, not for computers to execute.
06/13/2021 RVRJCE - Python - Day 1 18
Syntax and Grammar – doc strings
• Python documentation strings (or docstrings) provide a convenient way of
associating documentation with Python modules, functions, classes, and
methods. It's specified in source code that is used, like a comment, to document
a specific segment of code. Python docstrings are strings used right after the
definition of a function, method, class, or module. They can be accessed during
run time by __doc__ attribute.
• Example:
def square(n):
“”” Takes a number as input and returns its square”””
return n**2
print(square.__doc__)