Write Definition Function Called Product Function Receives Two Parameters Containing Integ Q37019628

Write a definition of a function called product. The functionreceives two parameters containing integer values. You may assumethat neither parameter is negative. The function returns theproduct of the parameters. So, product(3,5) returns 15. Thefunction must not use a loop of any kind (for, while,do-while).

This is what I had, but it said there was an executionerror.

def product(x,y):
    return (x *y)
a = int(input(“Enter first postive number:”))
b = int(input(“Enter second postive number:”))
print(product(a,b))


Solution


CODE:

def product(x,y):
return(x*y)
a=int(input(“Enter First positive Number:”))
b=int(input(“Enter Second Positive Number:”))
product(a,b)
print(product(a,b))

SCREENSHOT OFTHE PROGRAM:

product.py - C:/Users/Bhavani/Videos/product.py (3.7.2) File Edit Format Run Options Window Help def product (x,y): return (x

OUTPUT:

Python 3.7.2 Shell File Edit Shell Debug Options Window Help Python 3.7.2 (tags/v3.7.2:9a3ffco492, Dec 23 2018, 22:20:52) [MS

product.py

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.