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
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?
Local declarations are those that are kept in the memory of the computer; but, how exactly are they kept in memory? If reaching one's objective can be done without making use of local declarations, then doing so is a waste of time. Why bother using value parameters when you can just use references as your arguments in any function? How crucial are value parameters when it comes to the processing of programmed data?
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++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning