My issue
convert to lower case and predict position while subtracting ‘a’ only if alphabet from each character, then what is error in my code
My code
def alphabet_position(text):
# Your list comprehension goes here
# Hint: Use ord() to get ASCII value and chr() to convert back to character if needed
text = text.lower()
print(text)
result = [ord(x)-ord('a')+1 for x in text if x.isalpha()]
return result
if __name__ == "__main__":
input_string = input().strip()
result = alphabet_position(input_string)
print(result)
Learning course: Python Coding Challenges
Problem Link: Alphabet Position Mapper Practice Problem in Python Coding Challenges