Resolved: jupyter / python
hello;
I'm little bit confused because i don't understand why in videos he is using "return" however in exercices when we do the same we get an error or the answer is not accepted, we need instead use directly print()
I'm little bit confused because i don't understand why in videos he is using "return" however in exercices when we do the same we get an error or the answer is not accepted, we need instead use directly print()
1 answers ( 1 marked as helpful)
Hi Souhila!
Thanks for reaching out!
In the exercises, we use the print() function instead of return because the test checks the output directly as a string. The printed output must exactly match the expected answer to pass.
In the videos, return is used to demonstrate how functions work, but for these exercises, using print() is key to getting the expected output.
Thanks for asking, and I hope this clears things up!
Best,
Ivan
Thanks for reaching out!
In the exercises, we use the print() function instead of return because the test checks the output directly as a string. The printed output must exactly match the expected answer to pass.
In the videos, return is used to demonstrate how functions work, but for these exercises, using print() is key to getting the expected output.
Thanks for asking, and I hope this clears things up!
Best,
Ivan