163k views
3 votes
Functions that do not return values _________.

have return statements that return a 0.
have return statements that return an empty tuple.
do not have return statements.
are illegal in Python and cause a Throwback error.

2 Answers

5 votes

Answer:

Do not have return statements.

Step-by-step explanation:

In programming, a function is a block or group of program statements, specifically written to execute a given task. It is defined in any point of the program and called upon to interrupt the normal program flow.

Functions have locally defined variables and can also use global variable as well. When it is called, it may or may require an argument and a return statement of the needed parameter is defined. The return void statement returns a 0 value.

If a function is defined, but not called, it will not be executed and if a return statement is not defined in the function, it executed function would not return any value to the normal program flow.

User Rashin
by
5.5k points
2 votes

Answer:

Functions that do not return values do not have return statements.

Step-by-step explanation:

Lets take an example of a function in Python

def FunctionName(arguments)

function body

The function that do not return value does not need to have a return statement.

It works the same as void function C++

The function that do not return values and has no return statements will end when the program control reaches end of the function body. This works same as void but in Python None is returned when such a function ends successfully. None is a special value which is returned in functions that do not have return statements.

Lets take an example of a few functions that have return values and that do not have return values.

def addition(x,y):

a = b + c

summ = addition(1,2)

print(summ)

This function has no return values so there is no need to have a return statement. This will print None in the output

Another example is of the function that has a return statement and return values.

def addition(x,y):

a = b + c

return a

summ = addition(1,2)

print(summ)

Now this will give 3 as output and here return c is written which means that the function returns values.

User Jean Carlo Machado
by
5.3k points