Ask Question
18 June, 04:06

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.

+1
Answers (1)
  1. 18 June, 05:51
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers