Alien Flip word challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Alien Flip word challenge

In alien challenge, I was given a task to to flip a word of my choice in English language Please where did I get it wrong?? def reverse_string(string): if len(string) == 0: return string else: return reverse_string(string[1:]) + string[0] reverse_string("Python")

15th Aug 2020, 2:33 PM
Batubo Alafuro
Batubo Alafuro - avatar
3 Answers
+ 3
Proper indention was needed ๐Ÿ˜Š This could help you๐Ÿ‘‡๐Ÿ‘‡ https://code.sololearn.com/ce6VojhJj2Va/?ref=app
15th Aug 2020, 3:39 PM
SOUMYA
SOUMYA - avatar
+ 1
Add identation to else part.. And missing the printing of returned value.
15th Aug 2020, 2:59 PM
Jayakrishna ๐Ÿ‡ฎ๐Ÿ‡ณ
+ 1
Hey Batubo Alafuro Just Correct Your Indentation Of else Part And Yes You Just Wanna Flip Your Word For This You Donโ€™t Need To Define Function. You Can Solve Your Problem With Lesser Space Complexity. For Ex- x=input() print(x[::-1])
15th Aug 2020, 3:45 PM
Rahul Saxena
Rahul Saxena - avatar