Ask Question

What is the purpose of the "def" keyword in Python?

a) It is slang that means "the following code is really cool"

b) It indicates the start of a function

c) It indicates that the following indented section of code is to be stored for later

d) b and c are both true

e) None of the above

+5
Answers (1)
  1. 27 September, 15:29
    0
    d) b and c are both true.

    Explanation:

    The purpose of def keyword in python is to indicate start the function and it also indicates that the piece of code following the def keyword is to stored so that it can later be used in the program.

    For ex:

    def check (n):

    if n==10:

    return True

    return False

    n=int (input ("Enter an integer/n"))

    if check (n):

    print ("n is 10")

    else:

    print ("n is not 10")

    In the above written code the function check is defined by using the keyword def. It also tells the interpreter to store the code because we will need it in future.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the purpose of the "def" keyword in Python? a) It is slang that means "the following code is really cool" b) It indicates the start ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers