93.9k views
5 votes
Which of the following is true?

a) A function can have any number of return statements, or no return statement at all.
b) A function can only return strings and numbers, not lists or dictionaries.
c) A function must always have at least one return statement.
d) A function must have exactly one return statement, or no return statement at all.

1 Answer

6 votes

a) A function can have any number of return statements, or no return statement at all.

This statement is true. In many programming languages, including Python, a function can have multiple return statements or no return statement at all. The number of return statements and their placement within the function code depend on the desired functionality and requirements of the program.

User Zeratas
by
8.4k points