What problem I have?(¿Qué problema tengo?) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

What problem I have?(¿Qué problema tengo?)

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

15th Sep 2021, 1:23 AM
CGO!
CGO! - avatar
4 Answers
+ 4
You essentially have an infinite recursive loop. All you need is; def spell(t): if len(t) < 1: return print(t[-1]) spell(t[:-1])
15th Sep 2021, 2:02 AM
ChaoticDawg
ChaoticDawg - avatar
15th Sep 2021, 1:19 PM
CGO!
CGO! - avatar
+ 4
★ⒸⒶⓁⒺⒷ ⒼⓊⒺⓇⓇⒶ ⓄⓇⓉⒺⒼⒶ★ This might give you an idea about it: def my_func(txt): if not txt: return print(txt[-1]) my_func(txt[:-1]) # If this wasn't part of a challenge, I'd need to point out that recursion is very inefficient for this case
15th Sep 2021, 5:39 AM
Calvin Thomas
Calvin Thomas - avatar
+ 3
Check this code, I will not give you the whole problem solved, so you can think for yourself. https://code.sololearn.com/chms9dagYZPV/?ref=app
15th Sep 2021, 4:27 AM
Hacker-KR4636
Hacker-KR4636 - avatar