Ask 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 question, include this specific docstring: '''This function always returns 42.'''

+2
Answers (1)
  1. 18 September, 01:31
    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?
Find 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 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