(Nov-01-2017, 05:44 PM)RedSkeleton007 Wrote:
Error:Traceback (most recent call last): File "E:\Python\Python36-32\SamsPrograms\PasswordGuesser.py", line 12, in <module> guess[0] = char TypeError: 'str' object does not support item assignment
Strings are immutable. Which means you can't modify them. If you want to change the first character of a string to something else, you need to create a new string instead (or use something else that is mutable, like a list).
>>> chars = "spam" >>> chars[0] 's' >>> chars[0] = "e" Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object does not support item assignment >>> chars = "e" + chars[1:] >>> chars 'epam'