Hello can someone help me understand this well? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello can someone help me understand this well?

code = input()[::-1] spell = "" letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' ' ] for i in range(len(letters)-1): letters.append(letters[i].upper()) for i in code: if i in letters: spell += i print(spell)

22nd Sep 2021, 9:45 AM
Ann Appiah🦍
Ann Appiah🦍 - avatar
2 Answers
+ 2
Your code basically, takes an input as a string. If the string includes the given letters, reverses it and print the reversed string. I hope, it's clear. Happy coding!
22nd Sep 2021, 9:50 AM
mesarthim
mesarthim - avatar
+ 1
Thank you. I will look into it
22nd Sep 2021, 9:52 AM
Ann Appiah🦍
Ann Appiah🦍 - avatar