0
Can sb explain why the letters aren't on different rows. If you know how to correct it, pls🙏reply
Basically, I've been sitting for this code for a while(I'm a beginner) and I found many posts in Google about few different variants of how I can move strings on different lines(\n, end='') and nothing worked. The code seems correct itself but in the task it was said to output letters in different lines. Here's the link on my code: https://code.sololearn.com/ctgXwv2QL96I/?ref=app
2 Respuestas
+ 6
Olexandra Voichenko ,
see the code with my comments: (if this is not what you expect, please give a sample of input and how the output should be)
def spell(txt):
if not txt:
return
#first_letter = txt[0:] # this line is taking a slice from thd complete string
for letter in txt: # if letters has to be printed in different lines, we need to use a loop
print(letter)
txt = input()
spell(txt[::-1])
+ 2
Lothar,
understood, thanks for explanation. It helped🇺🇦