DEV Community

Ranjith srt
Ranjith srt

Posted on

6.Functions | py

function

A function is a block of code which only runs when it is called.

You can pass data, known as parameters, into a function.

A function can return data as a result.

def python():
print("Hello world")

Calling a Function:

``def python():
print("Hello world, python ")

Python ()``

Arguments

Information can be passed into functions as arguments.

Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma.

`def p_name(name, age):
Print ("name :" +name +"age :" +age)
p_name ("dhoni", "39" )

Output:

Name: Dhoni age: 39`

Tasks:
Image description

Playlist :
https://www.youtube.com/live/dGyoEQsc4iQ?si=9dArLhgssryp-eOl

Top comments (0)