Q. Write a function that takes amount-in-dollars and dollar-to-rupee conversion price ; it then returns the amount converted to rupees. Create the function in both void and non-void forms.


You can understand by Watching video :-



Answer :-

Void Function :- Which Function do not return any value.

Non Void :- Which Function return value.

 
def rup(doll) :     #void
    print("(void ) rupees in ",doll ,"dollar = ",doll * 72)

def rupee(doll) :  # non Void
    return doll * 72

doll = float(input("Enter dollar : "))

rup(doll)    #void

print("( non void ) rupees in ",doll ,"dollar = ", rupee(doll) )  # non Void

Output :-

Enter dollar : 1
(void ) rupees in  1.0 dollar =  72.0
( non void ) rupees in  1.0 dollar =  72.0

>>> 

Enter dollar : 63
(void ) rupees in  63.0 dollar =  4536.0
( non void ) rupees in  63.0 dollar =  4536.0

>>> 

Enter dollar : 3214
(void ) rupees in  3214.0 dollar =  231408.0
( non void ) rupees in  3214.0 dollar =  231408.0

>>>

Post a Comment

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

Previous Post Next Post