inputLine = input()
letters = "abcdefghijklmnopqrstuvwxyz"
secreMessage=""
for l in inputLine:
indexLetter=letters.find(l.lower())
if(indexLetter!=-1):
indexLetter+=1
secreMessage+=str(indexLetter)+"-"
else:
secreMessage+=l
print(secreMessage[:-1])
if we give input"sudheer kumar" it should print "s-u-d-h-e-e-r k-u-m-a-r" like this
but it is printing "s-u-d-h-e-e-r- k-u-m-a-r" like this
so can anyone please give correct code?
Here is the corrected code:
val = input('Enter name: ')
x = list(val)
answer = ''
for n in x:
answer = answer + str(n) + '-'
z = list(answer)
i1 = z.index(' ')
z.pop(i1+1)
z.pop(i1-1)
z.pop()
s = ''.join(z)
print(s)
Here is the result screen:
Comments
Leave a comment