Reverse working in IDLE and it works but on Code Academy?


On IDLE I run this function and I get the correct outcome but code acadamy keeps telling me it is returning 'None'....

def reverse(text):

for item in text:
print (output)


What is the return value of your function?

my_reversed_name = reverse('ionatan')
print 'my name looks like this after reversing it:', my_reversed_name


Thanks you've helped me inadvertly solve it. Code Academy wanted to to return the answer not print it.


No, that was very intentional.
It told you your return value was wrong, so check the return value. You assumed that you did what it said you did not. Assumptions are useful, but if you treat them like facts then this is what happens.


Ah I see, well thank you either way. Can I ask what the difference would be to put the print function in instead of the return?


Imagine if the + operator printed the result on the screen instead of returning a value to use. The result would be on screen, but your code wouldn't be able to use it.


Great, now the user knows about the value 10. But I want to subtract 2 from the result? I guess I'm out of luck.