CBSE Class 12 Computer Science
Question 50 of 62
Using Python Libraries — Question 3
Back to all questions 3
Question Given below is semi-complete code of a module basic.py :
#
"""..............."""
def square(x):
"""..............."""
return mul(x, x)
...............mul(x, y):
"""..............."""
return x * y
def div(x, y):
"""..............."""
return float(x)/y
...............fdiv(x, y)...............
"""..............."""
...............x//y
def floordiv(x, y)...............
...............fdiv(x, y)Complete the code. Save it as a module.
# basic.py
"""This module contains basic mathematical operations."""
def square(x):
"""Returns the square of a number."""
return mul(x, x)
def mul(x, y):
"""Returns the product of two numbers."""
return x * y
def div(x, y):
"""Returns the result of dividing x by y."""
return float(x) / y
def fdiv(x, y):
"""Returns the result of floor division of x by y."""
return x // y
def floordiv(x, y):
return fdiv(x, y)The code is saved with .py extension to save it as module.