Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
Expert Solution & Answer
Book Icon
Chapter 6, Problem 1D

Explanation of Solution

The two motivations for defining functions in your programs are: 

  • Reusability
  • Abstraction

The first motivation is reusability:

  • Once defined, a function can be used over and over and over again.
  • User can save your work by invoking the same function many times in the program.
  • Another aspect of reusability is that a single function can be used in several different and separate programs.
  • When a user needs to write a new program, user can go back to your old programs, find the functions he/she needs, and reuse those functions in his/her new program.
  • User can also reuse functions that somebody else has written...

Blurred answer
Students have asked these similar questions
In your own words, describe the two motivations for defining functions inyour programs.
Explain the difference(s) between calling a function by value and calling a function by reference, as well as when each should be used. What are the most significant distinctions between the two approaches of implementation?
How are local declarations stored in computer memory? Are there any reasons to avoid using local declarations if it is possible to achieve the same result without them? If reference parameters can be used in any function, why use value parameters at all? How are value parameters useful in processing data in a program?
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning