Q26. What do you mean by module object?
Ans: A value created by an import statement that provides access to the values defined in a module.
e.g import math , here math is a module object and using dot notation you can access the variables defined in this module for instance math.pi
Q27. What is the encapsulation?
Ans: It is the process of transforming a sequence of statements into a function definition. Everything is encapsulated inside the function.
Q28. What is the docstring in python?
Ans: Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, and methods.
An object's docstring is defined by including a string constant as the first statement in the object's definition.
def my_function(): """Do nothing, but document it. No, really, it doesn't do anything. """ |
You can print this doc string using: print my_function.__doc__
Q29. Which operator will help you get the remainder and quotient value in Python?
Ans: There are two mathematical operator to help you get quotient and remainder.
Getting remainder using ‘%’ modulus operator and ‘/’ to get the quotient value for example
quotient = 10 / 3 # will result 3 remainder = 10 % 3 #will result 1 |
Q30. What all are the relational operators?
Learn Python in Less than 8 Hours sitting at Home/@Desk
Ans: Below are all considered relational operator to do the comparison.
A !=B # A is not equal to B A>B # A is greater than B A<B # A is less than B A>=B # A is greater and equal to B A<=B #A is less than or equal to B |