curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/65688b5a1655a7a6caede847.md
When you try to change the individual characters of a string as you did in the previous step, you get a TypeError, which occurs when an object of inappropriate type is used in your code.
As you can see from the error message, strings do not support item assignment, because they are immutable. However, a variable can be reassigned another string:
message = 'Hello World'
message = 'Hello there!'
Delete the text[0] line and reassign text the string 'Albatross'.
You should not have text[0] = 'C' in your code.
const commentless_code = __helpers.python.removeComments(code);
assert.isFalse( /text\s*\[\s*0\s*\]\s*\=\s*("|')\w\1/.test(commentless_code));
You should reassign text the string 'Albatross'. Do not modify text = 'Hello World'.
({test: () => {
const commentless_code = __helpers.python.removeComments(code);
assert.match(commentless_code.replace(/\r/g, ''), /text\s*=\s*("|')Hello World\1\s+text\s*=\s*("|')Albatross\2/m);
}
})
--fcc-editable-region--
text = 'Hello World'
text[0] = 'C'
--fcc-editable-region--
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for char in text.lower():
index = alphabet.find(char)
print(char, index)
new_index = index + shift