Why the function doesn't work ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the function doesn't work ?

I want to have a code to reverse each input string but my code doesn't work ... By defining a function OR simple code of "input" how may I call my code to reverse any entered string ? This code doesn't work : https://code.sololearn.com/c4l4OZpGePDO/#py

23rd Jan 2018, 11:13 PM
NIMA
NIMA - avatar
2 Answers
+ 5
Function works, you just forgot to print: print(function ("hello world")) Instead of function ("hello world")
23rd Jan 2018, 11:39 PM
Jacob Pembleton
Jacob Pembleton - avatar
+ 2
def function (my_list): my_list_reverse = my_list [::-1] return my_list_reverse print(function ("hello world"))
24th Jan 2018, 1:05 AM
Daniel
Daniel - avatar