Computer Science, asked by ananyaa40, 6 months ago

explain with example any 10 function used in python​

Answers

Answered by Anonymous
2

\huge\boxed{\fcolorbox{black}{pink}{Answer}}

1.Keyword def that marks the start of the function header.

2.A function name to uniquely identify the function. 3.Function naming follows the same rules of writing identifiers in Python.

4.Parameters (arguments) through which we pass values to a function. They are optional.

A colon (:) to mark the end of the function header.

5.Optional documentation string (docstring) to describe what the function does.

6.One or more valid python statements that make up the function body. Statements must have the same indentation level (usually 4 spaces).

7.An optional return statement to return a value from the function.

8.Try running the above code in the Python program with the function definition to see the output.

9.Try running the following into the Python shell to see the output.

10.This statement can contain an expression that gets evaluated and the value is returned.

Answered by aradhyaatre
1

Answer:

Here

Explanation:

In Python, a function is a group of related statements that performs a specific task.

Functions help break our program into smaller and modular chunks. As our program grows larger and larger, functions make it more organized and manageable.

Furthermore, it avoids repetition and makes the code reusable.

Syntax of Function

def function_name(parameters):

"""docstring"""

statement(s)

Above shown is a function definition that consists of the following components.

Keyword def that marks the start of the function header.

A function name to uniquely identify the function. Function naming follows the same rules of writing identifiers in Python.

Parameters (arguments) through which we pass values to a function. They are optional.

A colon (:) to mark the end of the function header.

Optional documentation string (docstring) to describe what the function does.

One or more valid python statements that make up the function body. Statements must have the same indentation level (usually 4 spaces).

An optional return statement to return a value from the function.

Similar questions