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 trial

Python

User return or print() in the Battlecry method

I notice that in the battlecry method, you use "return" instead of "print" to give back the value of the variable "sound".

My expectation of this line of code is that, when you call it, the compiler will not print the value.

However, it actually does return the value "ROAR".

Can you explain why the compiler is able to display the value with 'return'?

Steven Parker
Steven Parker
243,656 Points

If you share your code someone might be able to spot the problem.

1 Answer

Steven Parker
Steven Parker
243,656 Points

Without seeing the code, this is just a wild guess.

But perhaps where the method is called the returned value is then printed?