Search This Blog

Python Hackerrank Sulution Quiz Answers

1. A sample module named sample_module.py contained the following contents.
def mul(x, y):
    """Multiplies two given numbers and returns the product.
    >>> mul(6, 7)
    42
    >>> mul(-8, 7)
    >>> -56
    """
    return x * y
What is the expected output when you run the doctests using below command?
python -m doctest sample_module.py

2. Which of the following doctest directive is used for not considering or executing a specific doctest?

3. Which of the following doctest directive is used to deal with unexpected whitespace that appears in the output?

4. Which of the following is a docstring?

5. Which of the following special attribute can be used to access a doc string in a program?














No comments:

Post a Comment

If you have any doubts, Please let us know.