Python Python Basics (2015) Logic in Python Product

Dolapo Sekoni
PRO
Dolapo Sekoni
Pro Student 1,431 Points

help with product

kindly show me what am doing wrong

product.py
def product(num1,num2):
    print(num1 * num2)

return(num1 * num2)

1 Answer

Alex Koumparos
MOD
Alex Koumparos
Python Web Development Treehouse Moderator 32,445 Points

Hi Dolapo

In your function you are printing the result of multiplying num and num2. The challenge wants you to return the result.

In your next line you are trying to return a value but you are not in the function so return is invalid and num1 and num2 are out of scope. If you wanted your return statement to be part of the function then you would need to have it indented to the same level as your print statement.