Sunday, November 10, 2019

printing unicode character in place of numbers in python

s= input("Enter some string:")
output=''
for x in s:
    if x.isalpha():
        output=output+x
        previous=x
    else:
        newch=chr(ord(previous)+int(x))
        output=output+newch
print(output)

output:
Enter some string:a4b2d9
aebddm

No comments:

Post a Comment

python class topic video