Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Product

Dolapo Sekoni
PLUS
Dolapo Sekoni
Courses Plus 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
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,861 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.