0

Why i can't define this function to print words in reverse order?

https://code.sololearn.com/c04xIz3QFHnH/?ref=app

14th Dec 2020, 9:48 PM
majid
majid - avatar
2 Respostas
+ 1
You have to understand. Variable used as argument vs parameter here word is a parameter .It is called argument in function call.You use hello as variable name not as argument .it must be a string written enter double quotes "hello".Then to reverse a string we use slicing string[::-1] for example.
14th Dec 2020, 10:10 PM
HBhZ_C
HBhZ_C - avatar
+ 1
:) there is no variable declared as drow! you have one parameter called word. So, in function you need to do something with this variable and then return result, or just print as HBhZ_C said, def flip(word): return word[::-1]
14th Dec 2020, 10:23 PM
Shadoff
Shadoff - avatar