DEV Community

Payilagam
Payilagam

Posted on

Python - Functions

Functions: Datatypes:

Functions: +2: Python: செயல்கூறு:
Methods / Procedure - Sub Procedure /

Meyyazhagan:

Watching_Meyyazhagan:
1. Laptop On
2. Netflix
3. Meyyazhagan
4. Play

What is Functions:
Set of Instructions for achieving a specific task with a name

WHY do we need function: Reusable Code:

Actions: Verb: வினைச்சொல்
playing_chess
playing_carrom
cooking
swimming
reading
watching

Object: Noun: பெயர்ச்சொல்
carromboard
chessboard
laptop

Function:
input()
print()

input() --> Arguments / Parameter
print()

eat(food)
sleep()
walk()
cook(rice, water)
swim(dress, pool)
write_exam(hallticket, pen, paper, pencil, scale, rubber, question_paper)

Supporting Arguments: Comma Separated arguments

Functions: input, print

input: 1 Argument

print: 2 Arguments

predefined functions: input, print

User defined Functions:

Function:

() --> action

def calculate(no1, no2):
print(no1+no2)
print(no1-no2)
print(no1*no2)
print(no1/no2)

Top comments (0)