Ask Question
3 August, 16:27

Writing a function. Write a function named weird that takes one input and always returns the number 42 (thus ignoring its input). In this question, include this specific docstring: '''This function always returns 42.'''

+1
Answers (1)
  1. 3 August, 17:44
    0
    def weird (inp):

    """This function always returns 42"""

    return 42

    Explanation:

    As specified in the question, this function even though it receives one parameter in this case inp It will always return the value 42.

    The docstring is added to the code.

    A docstring is a way of adding documentation which describes what a function, class or module does. It appears as the first line in the function's body with tripple quotes.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Writing a function. Write a function named weird that takes one input and always returns the number 42 (thus ignoring its input). 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