code:
str="hello world" in range(len(str)): str[i]=str[len(str)-i] print(str) this corresponds error in python. right way implement this?
- in python, strings immutable. can't reassign individual characters.
strnot variable name because masks built-in functionstr().- it looks want reverse string:
string = "hello world" reversed_string = string[::-1]
Comments
Post a Comment