Skip to content

6.2 Print Functions

Printing from a function

  • A common operation for a function is to print text
  • A function that only prints typically does not return a value
  • A function with no return statement is called a void function, and such a function returns the value None.

6%202%20Print%20Functions%2031f2aea755c94f15b791afac7cf45ff3/Untitled.png

Calling a print function multiple times

  • Program B is much more efficient and clean:

6%202%20Print%20Functions%2031f2aea755c94f15b791afac7cf45ff3/Untitled%201.png

  • Another example:

6%202%20Print%20Functions%2031f2aea755c94f15b791afac7cf45ff3/Untitled%202.png