SlideShare a Scribd company logo
Unit 2Unit 2
DATA , EXPRESSIONS, STATEMENTS
S.DHIVYA,AP/CSE
KONGUNADU COLLEGE OF
ENGINEERING AND TECHNOLOGY
KONGUNADU COLLEGE OF
ENGINEERING AND TECHNOLOGY
Python Programming History
It was created by Guido Van Rossum ,
python is derived from many other language
including ABC , Modula 3, C , C++ , Algol-68 ,
Small talk , Unix. It got name from “Monty
Python Flying Circus”.
‘python’ is a general purpose interpreted ,
interactive , object oriented ,and high level
language,
Released in 1991, it support both 32 and
64 bit integers and wordsize.
S.DHIVYA,AP/CSE
Python is High level language:
It is look like a normal English. It is most
compatible with human language.
Python is interpreted:
Python is processed at run time by the
interpreter, you do not need to compile your
program before executing it.
Python support Object –Oriented,
Python is a beginners language.
Python is interactive :
you can type into python prompt and interact
with the interpreter directly to write the program.
Advantages
S.DHIVYA,AP/CSE
Features and application of ‘python’
languages
• Python is general purpose ,structured
programming language.
• Easy to learn.
• Easy to maintain.
• Free and open source.
• High level language.
• Extensive libraries.
S.DHIVYA,AP/CSE
Why we need python
• Software quality
• Developer productivity
• Support library
• Enjoyment
• Program portability
S.DHIVYA,AP/CSE
PYTHON INTERPRETER
Source code
Input data
Interpreter
Output
S.DHIVYA,AP/CSE
Interpreter:
An interpreter processes the program a little at a time ,
alternatively reading lines and performing computation.
python Analyze and Executes program statements at the same
time ,
Overall Execution time is high,
Easier to debug the program.
There are two ways use interpreter:
1. Interactive mode - In this to type the program then press enter and
the interpreter displays the result.
>>> 2+2
>>> 4
The chevron , >>> is the prompt the interpreter uses to indicate that it is
ready.
2. Script mode:
If you type multiple statement into a file and save with .py
extension , then the interpreter execute the file is called a script,
S.DHIVYA,AP/CSE
Interactive mode
• The interpreter provides an interactive
environment to play with the language
• Results of expressions are printed on the
screen
>>> 3 + 7
10
>>> 3 < 15
True
>>> 'print me'
'print me'
>>> print 'print me'
print me
>>>
S.DHIVYA,AP/CSE
Interpreter Vs Compiler
Interpreter Compiler
Translates program one statement at a
time.
Scans the entire program and translates it
as a whole into machine code.
It takes less amount of time to analyze the
source code but the overall execution time
is slower.
It takes large amount of time to analyze
the source code but the overall execution
time is comparatively faster.
No intermediate object code is generated,
hence are memory efficient.
Generates intermediate object code
which further requires linking, hence
requires more memory.
Continues translating the program until
the first error is met, in which case it
stops. Hence debugging is easy.
It generates the error message only after
scanning the whole program. Hence
debugging is comparatively hard.
Programming language like Python, Ruby
use interpreters.
Programming language like C, C++ use
compilers.
S.DHIVYA,AP/CSE
Values and Types
Values:
• A value is one of the fundamental things like
word or a number that a program manipulate.
Types:
– Integer
– Float
– Booleans
– String
– List
S.DHIVYA,AP/CSE
Integer & Float
• Integer – whole numbers
Ex: a = 10
b = -25
• Float – floating point values
Ex:
a=6.5
b=10.14
• To view the type of data:
>>> c=64
>>> type(c)
<type int>
S.DHIVYA,AP/CSE
Boolean
• A Boolean variable can take two values
True
False
Ex:
>>> 34>64
False
>>> 68>45
True
>>> test=(45>32)
>>> test
True
S.DHIVYA,AP/CSE
Strings
• Set of characters represented in quotation marks,
either single or double quotes.
• Subsets of string can be taken by using the slice
operator[:] with index 0 is starting.
Character:
• It is a single alphabet represented by single, double
or trible quotes.
Ex: ‘a’ or “a” or ‘“a’’’
String:
• It is represented by more than one character within
single, double or trible quotes.
Ex: ‘Hi’ or “Hi” or ‘“Hi’’’
S.DHIVYA,AP/CSE
Operator on strings:
‘+’ and ‘*’
>>> ‘horse ’ + ‘and ’ + ‘dog’
horse and dog
>>> “#” * 5
#####
S.DHIVYA,AP/CSE
String operations
• Find() – to find whether the given character is
present in the string or not
• Ex:
>>> a=“hello world”
>>> print(a.find(“w”))
>>> 6
• Split() – to split the strings
• Ex:
>>> print(a.split(“ ”))
(‘hello’,‘world’)
S.DHIVYA,AP/CSE
• Slicing – to view particular character or string
Ex: >>> print(a[6:12])
world
• Strip() –to remove a string
Ex: >>> print(a.strip(“hel”))
o world
• lstrip() –to remove the first character from the
string
Ex: >>> print(a.lstrip(“h”))
ello world
>>> b=‘44444hihello222’
>>> print(b.lstrip(‘4’))
hihello222
S.DHIVYA,AP/CSE
• upper() – to convert the strings into uppercase
Ex: >>> d=“welcome”
>>> print(d.upper())
WELCOME
• lower() - to convert the strings into lowercase
EX: >>> e=“PYTHON”
>>> print(e.lower())
python
• String Concatenation (+) – to add two strings
Ex: >>> ‘how ’ + ‘are ’ + ‘you’
>>> how are you
S.DHIVYA,AP/CSE
String Reverse
S.DHIVYA,AP/CSE
List
• A list contains items separated by commas and
enclosed with square bracket [ ] .
• List and arrays are same in python.
• values stored in list is accessed by using its index
or its value by slicing.
>>> List_name=[ ] - empty list
>>> List=[“ram”,31,54,12,47]
>>> list
[“ram”,31,54,12,47]
S.DHIVYA,AP/CSE
List – Operations
• To View a particular value in a list
>>> d=[“hi”,34,64,“rani”,12]
>>> print(d[2])
64
• Update() – to update a value in a list
>>> L1=[10,11,12,13,15]
>>> L1[4]=14
>>> L1
[10,11,12,13,14]
• Delete() – to delete a value from a list
>>> del L1[2]
>>> L1
[10,11,13,14]
S.DHIVYA,AP/CSE
• len() – to find the length of a list
>>> len(L1)
4
• Concadenate
>>> [1,2,3] + [4,5,6]
[1,2,3,4,5,6]
• Append() – to add a new value at last of a list
>>> L2=[‘eat’, ‘more’, ‘fruits’]
>>> L2.append(‘daily’)
>>> L2
[‘eat’, ‘more’, ‘fruits’, ‘daily’]
>>> L2.append([‘aaa’,23]) – to append a new list
[‘eat’, ‘more’, ‘fruits’, ‘daily’,[‘aaa’,23]]
S.DHIVYA,AP/CSE
• Extend() – to add a list of elements
>>> L2.extend([‘hi’,43])
>>> L2
[‘eat’, ‘more’, ‘fruits’, ‘daily’,[‘aaa’,23],‘hi’,43]
S.DHIVYA,AP/CSE
• Slicing in list:
>>> list=["ram",54,64,78]
>>> print(list[2:3])
[64]
>>> print(list[:])
['ram', 54, 64, 78]
>>> print(list[:3])
['ram', 54, 64]
>>> print(list[3:])
[78]
>>> print(list[1:3])
[54, 64]
S.DHIVYA,AP/CSE
Variables
• A variable is nothing but a reserved memory
location to store values.
• Ex:
>>> a=5 // integer variable
>>> print (a)
5
S.DHIVYA,AP/CSE
Rules for naming variable
• Variable can be combination of uppercase,
lowercase, underscores(_) and digits(0-9).
• Special characters not allowed within
identifier.
• An variable not begin with numbers.
• Python keyword not used as a identifier.
S.DHIVYA,AP/CSE
Local and Global variable
• Local variable:
a variable which is declared inside a
function is called as local variable.
• Global variable:
a variable which is declared outside a
function is called as global variable.
S.DHIVYA,AP/CSE
Expression
• Expression is the combination of variables
and constants are interconnected with
operators.
• Syntax: variable = expression
• Ex: d = (a+b*c)
S.DHIVYA,AP/CSE
Statements
• It is an instruction which is executed by
python interpreter.
@ Print
@ Assign
>>> x=2 # assigning a value
>>> print(x) # print statement
2
S.DHIVYA,AP/CSE
Multiline statements
>>> a=1
>>> b=2
>>> sum=a+
b
>>> print(sum)
3
Multiline statement in a single line by using (;)
>>> c=5;d=6;sum=c+d;print(sum)
11
S.DHIVYA,AP/CSE
Tuple Assignment
• Tuple contains items separated by commas and
enclosed with parenthesis().
• Values cannot be edit or update, insert a new value in
Tuple.
Ex: >>> tuple1=(“ram”,54,656,50)
>>> print(tuple1)
‘ram’,54,656,50
>>> print(tuple1[0])
‘ram’
>>> print(tuple1[1:3])
54,656
S.DHIVYA,AP/CSE
Precedence of operator
• High : / * %
• Low : + -
Ex:
workout this expression and write correct answer
3 - 12/3 + 77 * 3 - 1
S.DHIVYA,AP/CSE
Comments
# sign used to write comment line in between the programs.
Cannot be executed.
Types :
– Single line
– Multi line
Single line:
Single line comment starting with # symbol
Ex:
# This is a sample example
a=10
# The value 10 is assigned to a variable
print(a)
S.DHIVYA,AP/CSE
Output:
10
Multi line:
Multi line comment starting with # symbol
Ex:
# This is a sample
# to print a string
print(“hello”)
Output:
hello
S.DHIVYA,AP/CSE
Module
• a module is a file consisting of Python code. A
module can define functions, classes and variables.
A module can also include runnable code.
Example:
Here's an example of a simple module, support.py
def print_func( par ):
print ("Hello : ", par )
return
S.DHIVYA,AP/CSE

More Related Content

PDF
file handling c++
PPTX
File Management in C
PDF
Python Basics
PPT
File handling in c
PDF
Unit 4.1 (tree)
PPTX
Looping statement in python
PPTX
Python programming | Fundamentals of Python programming
file handling c++
File Management in C
Python Basics
File handling in c
Unit 4.1 (tree)
Looping statement in python
Python programming | Fundamentals of Python programming

What's hot (20)

PPTX
Introduction to python for Beginners
PPTX
Chapter 02 functions -class xii
PPT
9. Input Output in java
PPT
Strings Functions in C Programming
PDF
Python tuple
PPT
Introduction to Python
PPTX
File Handling Python
PDF
Variables & Data Types In Python | Edureka
PDF
Python Manuel-R2021.pdf
PDF
DSA (Data Structure and Algorithm) Questions
PPTX
Python
PPTX
Structure of the compiler
PPT
Unit 2 python
PPTX
File in C language
PDF
Python Basics.pdf
PPT
Unit 1 python (2021 r)
PPTX
Generating code from dags
PDF
Operators in python
PPTX
Multiplication algorithm
PPT
C program
Introduction to python for Beginners
Chapter 02 functions -class xii
9. Input Output in java
Strings Functions in C Programming
Python tuple
Introduction to Python
File Handling Python
Variables & Data Types In Python | Edureka
Python Manuel-R2021.pdf
DSA (Data Structure and Algorithm) Questions
Python
Structure of the compiler
Unit 2 python
File in C language
Python Basics.pdf
Unit 1 python (2021 r)
Generating code from dags
Operators in python
Multiplication algorithm
C program
Ad

Similar to Python unit 2 as per Anna university syllabus (20)

PPTX
Introduction to learn and Python Interpreter
PPT
UNIT 1 PY .ppt - PYTHON PROGRAMMING BASICS
PDF
Python.pdf
PPTX
Python Scipy Numpy
PPTX
Python basics
PPTX
Python basics
PPTX
Python basics
PPTX
Python basics
PPTX
Python basics
PPTX
Python basics
PPTX
Python basics
PPTX
Review of C programming language.pptx...
PPSX
Esoft Metro Campus - Programming with C++
PPT
Python
PDF
The New Yorker cartoon premium membership of the
PPTX
C programming language
PPTX
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
PPTX
#Code2 create c++ for beginners
PPTX
scripting in Python
Introduction to learn and Python Interpreter
UNIT 1 PY .ppt - PYTHON PROGRAMMING BASICS
Python.pdf
Python Scipy Numpy
Python basics
Python basics
Python basics
Python basics
Python basics
Python basics
Python basics
Review of C programming language.pptx...
Esoft Metro Campus - Programming with C++
Python
The New Yorker cartoon premium membership of the
C programming language
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
#Code2 create c++ for beginners
scripting in Python
Ad

Recently uploaded (20)

PDF
PPT on Performance Review to get promotions
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
composite construction of structures.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
additive manufacturing of ss316l using mig welding
DOCX
573137875-Attendance-Management-System-original
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Digital Logic Computer Design lecture notes
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPT on Performance Review to get promotions
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
composite construction of structures.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
additive manufacturing of ss316l using mig welding
573137875-Attendance-Management-System-original
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Automation-in-Manufacturing-Chapter-Introduction.pdf
Digital Logic Computer Design lecture notes
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
bas. eng. economics group 4 presentation 1.pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Mechanical Engineering MATERIALS Selection
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Lecture Notes Electrical Wiring System Components
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx

Python unit 2 as per Anna university syllabus

  • 1. Unit 2Unit 2 DATA , EXPRESSIONS, STATEMENTS S.DHIVYA,AP/CSE KONGUNADU COLLEGE OF ENGINEERING AND TECHNOLOGY KONGUNADU COLLEGE OF ENGINEERING AND TECHNOLOGY
  • 2. Python Programming History It was created by Guido Van Rossum , python is derived from many other language including ABC , Modula 3, C , C++ , Algol-68 , Small talk , Unix. It got name from “Monty Python Flying Circus”. ‘python’ is a general purpose interpreted , interactive , object oriented ,and high level language, Released in 1991, it support both 32 and 64 bit integers and wordsize. S.DHIVYA,AP/CSE
  • 3. Python is High level language: It is look like a normal English. It is most compatible with human language. Python is interpreted: Python is processed at run time by the interpreter, you do not need to compile your program before executing it. Python support Object –Oriented, Python is a beginners language. Python is interactive : you can type into python prompt and interact with the interpreter directly to write the program. Advantages S.DHIVYA,AP/CSE
  • 4. Features and application of ‘python’ languages • Python is general purpose ,structured programming language. • Easy to learn. • Easy to maintain. • Free and open source. • High level language. • Extensive libraries. S.DHIVYA,AP/CSE
  • 5. Why we need python • Software quality • Developer productivity • Support library • Enjoyment • Program portability S.DHIVYA,AP/CSE
  • 6. PYTHON INTERPRETER Source code Input data Interpreter Output S.DHIVYA,AP/CSE
  • 7. Interpreter: An interpreter processes the program a little at a time , alternatively reading lines and performing computation. python Analyze and Executes program statements at the same time , Overall Execution time is high, Easier to debug the program. There are two ways use interpreter: 1. Interactive mode - In this to type the program then press enter and the interpreter displays the result. >>> 2+2 >>> 4 The chevron , >>> is the prompt the interpreter uses to indicate that it is ready. 2. Script mode: If you type multiple statement into a file and save with .py extension , then the interpreter execute the file is called a script, S.DHIVYA,AP/CSE
  • 8. Interactive mode • The interpreter provides an interactive environment to play with the language • Results of expressions are printed on the screen >>> 3 + 7 10 >>> 3 < 15 True >>> 'print me' 'print me' >>> print 'print me' print me >>> S.DHIVYA,AP/CSE
  • 9. Interpreter Vs Compiler Interpreter Compiler Translates program one statement at a time. Scans the entire program and translates it as a whole into machine code. It takes less amount of time to analyze the source code but the overall execution time is slower. It takes large amount of time to analyze the source code but the overall execution time is comparatively faster. No intermediate object code is generated, hence are memory efficient. Generates intermediate object code which further requires linking, hence requires more memory. Continues translating the program until the first error is met, in which case it stops. Hence debugging is easy. It generates the error message only after scanning the whole program. Hence debugging is comparatively hard. Programming language like Python, Ruby use interpreters. Programming language like C, C++ use compilers. S.DHIVYA,AP/CSE
  • 10. Values and Types Values: • A value is one of the fundamental things like word or a number that a program manipulate. Types: – Integer – Float – Booleans – String – List S.DHIVYA,AP/CSE
  • 11. Integer & Float • Integer – whole numbers Ex: a = 10 b = -25 • Float – floating point values Ex: a=6.5 b=10.14 • To view the type of data: >>> c=64 >>> type(c) <type int> S.DHIVYA,AP/CSE
  • 12. Boolean • A Boolean variable can take two values True False Ex: >>> 34>64 False >>> 68>45 True >>> test=(45>32) >>> test True S.DHIVYA,AP/CSE
  • 13. Strings • Set of characters represented in quotation marks, either single or double quotes. • Subsets of string can be taken by using the slice operator[:] with index 0 is starting. Character: • It is a single alphabet represented by single, double or trible quotes. Ex: ‘a’ or “a” or ‘“a’’’ String: • It is represented by more than one character within single, double or trible quotes. Ex: ‘Hi’ or “Hi” or ‘“Hi’’’ S.DHIVYA,AP/CSE
  • 14. Operator on strings: ‘+’ and ‘*’ >>> ‘horse ’ + ‘and ’ + ‘dog’ horse and dog >>> “#” * 5 ##### S.DHIVYA,AP/CSE
  • 15. String operations • Find() – to find whether the given character is present in the string or not • Ex: >>> a=“hello world” >>> print(a.find(“w”)) >>> 6 • Split() – to split the strings • Ex: >>> print(a.split(“ ”)) (‘hello’,‘world’) S.DHIVYA,AP/CSE
  • 16. • Slicing – to view particular character or string Ex: >>> print(a[6:12]) world • Strip() –to remove a string Ex: >>> print(a.strip(“hel”)) o world • lstrip() –to remove the first character from the string Ex: >>> print(a.lstrip(“h”)) ello world >>> b=‘44444hihello222’ >>> print(b.lstrip(‘4’)) hihello222 S.DHIVYA,AP/CSE
  • 17. • upper() – to convert the strings into uppercase Ex: >>> d=“welcome” >>> print(d.upper()) WELCOME • lower() - to convert the strings into lowercase EX: >>> e=“PYTHON” >>> print(e.lower()) python • String Concatenation (+) – to add two strings Ex: >>> ‘how ’ + ‘are ’ + ‘you’ >>> how are you S.DHIVYA,AP/CSE
  • 19. List • A list contains items separated by commas and enclosed with square bracket [ ] . • List and arrays are same in python. • values stored in list is accessed by using its index or its value by slicing. >>> List_name=[ ] - empty list >>> List=[“ram”,31,54,12,47] >>> list [“ram”,31,54,12,47] S.DHIVYA,AP/CSE
  • 20. List – Operations • To View a particular value in a list >>> d=[“hi”,34,64,“rani”,12] >>> print(d[2]) 64 • Update() – to update a value in a list >>> L1=[10,11,12,13,15] >>> L1[4]=14 >>> L1 [10,11,12,13,14] • Delete() – to delete a value from a list >>> del L1[2] >>> L1 [10,11,13,14] S.DHIVYA,AP/CSE
  • 21. • len() – to find the length of a list >>> len(L1) 4 • Concadenate >>> [1,2,3] + [4,5,6] [1,2,3,4,5,6] • Append() – to add a new value at last of a list >>> L2=[‘eat’, ‘more’, ‘fruits’] >>> L2.append(‘daily’) >>> L2 [‘eat’, ‘more’, ‘fruits’, ‘daily’] >>> L2.append([‘aaa’,23]) – to append a new list [‘eat’, ‘more’, ‘fruits’, ‘daily’,[‘aaa’,23]] S.DHIVYA,AP/CSE
  • 22. • Extend() – to add a list of elements >>> L2.extend([‘hi’,43]) >>> L2 [‘eat’, ‘more’, ‘fruits’, ‘daily’,[‘aaa’,23],‘hi’,43] S.DHIVYA,AP/CSE
  • 23. • Slicing in list: >>> list=["ram",54,64,78] >>> print(list[2:3]) [64] >>> print(list[:]) ['ram', 54, 64, 78] >>> print(list[:3]) ['ram', 54, 64] >>> print(list[3:]) [78] >>> print(list[1:3]) [54, 64] S.DHIVYA,AP/CSE
  • 24. Variables • A variable is nothing but a reserved memory location to store values. • Ex: >>> a=5 // integer variable >>> print (a) 5 S.DHIVYA,AP/CSE
  • 25. Rules for naming variable • Variable can be combination of uppercase, lowercase, underscores(_) and digits(0-9). • Special characters not allowed within identifier. • An variable not begin with numbers. • Python keyword not used as a identifier. S.DHIVYA,AP/CSE
  • 26. Local and Global variable • Local variable: a variable which is declared inside a function is called as local variable. • Global variable: a variable which is declared outside a function is called as global variable. S.DHIVYA,AP/CSE
  • 27. Expression • Expression is the combination of variables and constants are interconnected with operators. • Syntax: variable = expression • Ex: d = (a+b*c) S.DHIVYA,AP/CSE
  • 28. Statements • It is an instruction which is executed by python interpreter. @ Print @ Assign >>> x=2 # assigning a value >>> print(x) # print statement 2 S.DHIVYA,AP/CSE
  • 29. Multiline statements >>> a=1 >>> b=2 >>> sum=a+ b >>> print(sum) 3 Multiline statement in a single line by using (;) >>> c=5;d=6;sum=c+d;print(sum) 11 S.DHIVYA,AP/CSE
  • 30. Tuple Assignment • Tuple contains items separated by commas and enclosed with parenthesis(). • Values cannot be edit or update, insert a new value in Tuple. Ex: >>> tuple1=(“ram”,54,656,50) >>> print(tuple1) ‘ram’,54,656,50 >>> print(tuple1[0]) ‘ram’ >>> print(tuple1[1:3]) 54,656 S.DHIVYA,AP/CSE
  • 31. Precedence of operator • High : / * % • Low : + - Ex: workout this expression and write correct answer 3 - 12/3 + 77 * 3 - 1 S.DHIVYA,AP/CSE
  • 32. Comments # sign used to write comment line in between the programs. Cannot be executed. Types : – Single line – Multi line Single line: Single line comment starting with # symbol Ex: # This is a sample example a=10 # The value 10 is assigned to a variable print(a) S.DHIVYA,AP/CSE
  • 33. Output: 10 Multi line: Multi line comment starting with # symbol Ex: # This is a sample # to print a string print(“hello”) Output: hello S.DHIVYA,AP/CSE
  • 34. Module • a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code. Example: Here's an example of a simple module, support.py def print_func( par ): print ("Hello : ", par ) return S.DHIVYA,AP/CSE