Q. Import the above module basics.py and write statements for the following:


(a) Compute square of 19.23


(b) Compute floor division of 1000.01 with 100.23


(c) Compute product of 3, 4 and 5 (Hint: use a function multiple times)


(d) What is the difference between basics.div(100,0 ) and basics.div(0, 100)?


Answer =

import basic

(a)

>>>basic.square(19.23)
>>>369.79290000000003

(b)

>>>basic.floordiv(1000.01 ,100.23 )
>>>9.0

(c)

>>> file.mul(3,4)
12

>>> file.mul(12,5)
60

(d)

basics.div(100,0 ) it will give error (i.e. ZeroDivisionError)

While

basics.div(0, 100) it will give output i.e. is 0.

2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post