Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAurelie Sacoman
723 PointsCan we use .format for return call ?
Hello Everyone,
For the excercice product.py, we need to create a definition product with 2 arguments and to multiple their return.
I get a good response using : def product(name1, name2): return name1 * name2
I was wondering, could we not use format to do that? I tried it but doesn't sounds to work.
def product(name1, name2): return("{} * {}").format(name1, name2)
Maybe I am not writing it correctly or this doesn't work with return?
thanks everyone
def product(name1, name2)"
return name1 * name2
1 Answer
Alexander Davison
65,469 PointsYou are sooooo close!
You just typed a " double quote instead of a : colon.
Your code
def product(name1, name2)" <------- Error is here. You used a double quote instead of a colon!
return name1 * name2
Complete code
def product(name1, name2): # <------- Fixed! Yay!
return name1 * name2
I hope this helps.
~Alex