I am trying to run a python code but it's showing attribute error-
my_string = "Hello, world!"
my_string.reverse()
Output for the above code:
Traceback (most recent call last):
File "c:\Users\name\OneDrive\Desktop\demo.py", line 2, in <module>
my_string.reverse()
^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'reverse'
Could you please help me solve this?
Thanks in advance.