Suppose you have a string s and an integer array roll . I want to increment each of the letters of s by 1 depending on the number in roll . For example, if s = "abc" and roll = [1,2] , then the output would be s = "ccc" .
When I run the below code, I keep getting the original string s Why is this?
def rollTheString(s, roll):
for i in range(0, len(roll)):
for j in range(0,i):
s[j] = (chr(ord(s[j])+1));
return s;
'abc'become'ccc'with[1,2]?bbc.