def main():
N = input("Enter a string: ")
O=""
for letter in N:
num=getNum(letter)
if(num!=-1):
O+=str(num)+"-"
else:
O+=letter
print(O[:-1])
def getNum(letter):
characters = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,len(characters)):
if letter.islower() and letter==characters[i]:
return i+1
if letter.isupper() and letter==characters[i].upper():
return i+1
return -1
main()
Comments
Leave a comment