Computer Science, asked by sanjanachakalabbi, 8 months ago

what are functions? why we need functions? (python programming language)​

Answers

Answered by Anonymous
37

A function is a rule which relates the values of one variable quantity to the values of another variable quantity, and does so in such a way that the value of the second variable quantity is uniquely determined by (i.e. is a function of) the value of the first variable quantity

Functions are group of statement that together perform a certain task. Functions are basically used to avoid rewriting of same code again and again. Suppose you have to perform a task 3 to 4 times in a program like to calculate the maximum out of two no.

Answered by queensp73
18

Answer:

Functions in Python. You use functions in programming to bundle a set of instructions that you want to use repeatedly or that, because of their complexity, are better self-contained in a sub-program and called when needed. That means that a function is a piece of code written to carry out a specified task.

Functions in Python. A function is a set of statements that take inputs, do some specific computation and produces output. Python provides built-in functions like print(), etc. but we can also create your own functions. These functions are called user-defined functions.

Functions in python are defined using the block keyword "def", followed with the function's name as the block's name. For example: def my_function(): print("Hello From My Function!")

Explanation:

Hope it helps u my frd

>>Follow me<<

#Keep smiling :)

Similar questions