Try the fastest way to create flashcards
Question

What statement do you have to have in a value-returning function?

Solution

Verified
Step 1
1 of 2

The difference between a void function and a value-returning function is the existence of a return\texttt{return} statement in a value-returning function. This statement sends some value back to the point in the program where the function was called.

Example:

def hello(): return 'Greetings from R'lyeh'

print(hello())

The hello()\texttt{hello()} function returns the string ’Greetings from Rlˊyeh’\texttt{'Greetings from R\'lyeh'} to the print()\texttt{print()} function from where it was called.

Create a free account to view solutions

Create a free account to view solutions

Recommended textbook solutions

Starting Out with Python 3rd Edition by Tony Gaddis

Starting Out with Python

3rd EditionISBN: 9780133582734Tony Gaddis
618 solutions
Fundamentals of Database Systems 7th Edition by Ramez Elmasri, Shamkant B. Navathe

Fundamentals of Database Systems

7th EditionISBN: 9780133970777Ramez Elmasri, Shamkant B. Navathe
948 solutions
Introduction to Algorithms 3rd Edition by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen

Introduction to Algorithms

3rd EditionISBN: 9780262033848Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
872 solutions
Introduction to Algorithms 4th Edition by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen

Introduction to Algorithms

4th EditionISBN: 9780262046305Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
945 solutions

More related questions

1/4

1/7