+ 1

Can i change a letter in a string in a list

word =['hello'] word [0][0] = 'H'

29th Nov 2017, 5:16 AM
Dryden
Dryden - avatar
2 Answers
+ 1
The following code you gave above won't work.Strings can only be used to read and can't change its value when you see it in the form of touples .â˜ș But still you could change the value given the string by the slicing methord ,😉 like this :: word=["hello"] print ("H"+word[0][1:]) I hope you understand .....đŸ˜‹đŸ˜‹đŸ˜‹đŸ€—
29th Nov 2017, 6:34 AM
VISHNU P.S
VISHNU P.S - avatar
+ 1
it worked! đŸ€Łi hope to learn more about the slicing method later in the lessons
29th Nov 2017, 2:50 PM
Dryden
Dryden - avatar