Ask Question
23 May, 15:27

In your own words, explain at least one reason why programming languages have functions. Include an example of something you did in this lesson that demonstrates the reason you describe.

+5
Answers (1)
  1. 23 May, 16:53
    0
    In programming, function is a block of codes which can be reused to perform a specific task. Functions are ubiquitous in many real world program. One reason why programming languages have functions is that the function can greatly reduce code redundancy. The codes that perform a specific task (e. g. addition), can be grouped into a function block. We just need to call the function name to run that block of code in any part of our program whenever necessary instead of keep writing the same block code over and over again.

    One example of function is given below:

    def addition (x, y):

    result = x + y

    return result

    To use the function above to perform addition, we just simply call the function name, addition (2, 5), by passing two values to parameter x and y and it will return addition result, 7. We can repeat the similar function calling by passing another parameters to it and get the addition result accordingly.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “In your own words, explain at least one reason why programming languages have functions. Include an example of something you did in this ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers