Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 488 Bytes

File metadata and controls

18 lines (15 loc) · 488 Bytes

What Did I Learn?

In this challenge I learned how to remove the last two letters from the string:

  1. If the letter = '#' we remove the last two letters stored in the answer and put the one we want
 if letter == '#':
    ans = ans[:-2]
    number = int(str(s[i-2]) + str(s[i-1])) + ord('a') - 1
    ans += chr(number)
  1. If it is a number, we store the respective letter in the answer
else:
    number = int(s[i]) + ord('a') - 1
    ans += chr(number)