0% found this document useful (0 votes)
19 views

B

The document contains details about students names, chapters for revision in 12th standard and an explanation of functions in Python with examples. It lists the names of students and chapters for revision. It then explains what a function is and provides examples to demonstrate defining and calling functions with and without arguments.

Uploaded by

Sudha Babu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

B

The document contains details about students names, chapters for revision in 12th standard and an explanation of functions in Python with examples. It lists the names of students and chapters for revision. It then explains what a function is and provides examples to demonstrate defining and calling functions with and without arguments.

Uploaded by

Sudha Babu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

abirami
2. vidhyalakshmi
3. jhotishkavin - dav
4. pritiksha
5. mritunjay
6. tarika
7. pranav kumaar
8. sivakarthikeyan
9. raja
10. seetha lakshmi
11. sailesh
12. sanjitha
13. sreevas
14. sruthi
15. hrishikesh
16. sanjiv
17. pravanthytha
18. pradeesh
19. shreya
20 pranetha
21. sakthe priya
22. darun

12th Chapters
1. Revision Tour 1
2. Revision Tour 2
3.Functions
4. File handling
1.text files
2.binary files
3.csv files
5. error handling
6. data base concepts
7. sql basics
8. sql more queries
9. sql connectivity
10.data structure
11. networking -1
12. networking -2

Functions
=> same set of statement will repeat in diff times we
can functions
=> same set of statement will repeat in diff times
that block of statement will store in a named unit known as function.
book
=> Function is a subprogram that acts on a data and often
returns a value

example with out function


print("abirami")
print("mvm")
print("chetpet")
print("chennai")
print("600029")
print("darun")
print("mvm")
print("chetpet")
print("chennai")
print("600029")
print("vidya lakshmi")
print("mvm")
print("chetpet")
print("chennai")
print("600029")
print("jhotiskavin")
print("mvm")
print("chetpet")
print("chennai")
print("600029")

"""
20 lines
abirami
darun
vidya
jhotiskavin

common address
mvm
chetpet
chennai
600029

"""
using functions
solution:

def schooldata():
print("mvm")
print("chetpet")
print("chennai")
print("600029")

print("abirami")
schooldata()
print("darun")
schooldata()
print("vidya lakshmi")
schooldata()
print("jhotiskavin")
schooldata()
"""
abirami
mvm
chetpet
chennai
600029
darun
mvm
chetpet
chennai
600029
vidya lakshmi
mvm
chetpet
chennai
600029
jhotiskavin
mvm
chetpet
chennai
600029
"""
syntax for function
def functionname(arg1,arg2,arg......):
statement1
statement
note:
def => keyword . function starts
functioname=> identifier
arg1,arg2,arg3=> necessary argument
statement1=> processing statement
example
function definition
def schooldata(): ## function header
print("mvm") -----------------|
print("chetpet") | body of function
print("chennai") -------------|

() => without arugment

1. write a python function addition() to add two values.


functionname:addition()
solution:
def addition(): ## function definition
a=10
b=20
c=a+b
print("c value=",c)
addition() ## function calling

example for functions


def addition(a,b): ## function definition
c=a+b
print("c value=",c)
a=10
b=20
addition(a,b)
p=50
q=70
addition(p,q)
m=50
n=60
o=90
addition(m,n,o) ## error no of argument not same a
"""
c value= 30
c value= 120
Traceback (most recent call last):
File "C:/Users/New/AppData/Local/Programs/Python/Python37-32/kk.py", line 13, in
<module>
addition(m,n,o) ## error no of argument not same
TypeError: addition() takes 2 positional arguments but 3 wer

"""

3.write a python function area() to find the area of square


area=a^2
functionname:area()
argument =>a
solution
def area(a):
c=a**2
print("area of square=",c)
a=int(input("enter a value"))
area(a)
"""
enter a value3
area of square= 9
"""

saturday 8.30pm
repeate => 10 to 15min

1.30pm => 12board exam

You might also like