SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Y Daniel Lang
Chapter:
.functions
Exercise:
Check Point
Question:1 | ISBN:978013274719 | Edition: 6

Question

What are the benefits of using a function?

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

A function is a set of instructions which perform a specific task. The function is capable to accept the input, after that perform some operation and can capable to return a value or an output.

The sample code for creating a function is:

def function_name():
	# statement (s)
	return 0

The benefit of using a function is listed below:

  • It reduces the errors and can detect the errors easily.
  • It divides a complex program into simpler one.
  • It avoids the repletion of the code.
  • It increases the code readability.
  • The modifications can become so easier by using function.
0 0

Discussions

Post the discussion to improve the above solution.