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():


This content originally appeared on DEV Community and was authored by Ranjith Jr

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


This content originally appeared on DEV Community and was authored by Ranjith Jr


Print Share Comment Cite Upload Translate Updates
APA

Ranjith Jr | Sciencx (2024-07-18T07:17:52+00:00) 6.Functions | py. Retrieved from https://www.scien.cx/2024/07/18/6-functions-py/

MLA
" » 6.Functions | py." Ranjith Jr | Sciencx - Thursday July 18, 2024, https://www.scien.cx/2024/07/18/6-functions-py/
HARVARD
Ranjith Jr | Sciencx Thursday July 18, 2024 » 6.Functions | py., viewed ,<https://www.scien.cx/2024/07/18/6-functions-py/>
VANCOUVER
Ranjith Jr | Sciencx - » 6.Functions | py. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/18/6-functions-py/
CHICAGO
" » 6.Functions | py." Ranjith Jr | Sciencx - Accessed . https://www.scien.cx/2024/07/18/6-functions-py/
IEEE
" » 6.Functions | py." Ranjith Jr | Sciencx [Online]. Available: https://www.scien.cx/2024/07/18/6-functions-py/. [Accessed: ]
rf:citation
» 6.Functions | py | Ranjith Jr | Sciencx | https://www.scien.cx/2024/07/18/6-functions-py/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.