Hello! I was trying to experiment a little bit with string methods and came up with this secret message:
secret_message = "Ieightlikeeighteatingninepizza"
My idea was to separate the string for every “eight” and “nine”. I tried to concatenate both methods at the same time:
decoded =secret_message.split("nine").split("eight") print(decoded)
However, an Attribute Error shows up. It works when I delete one of the
.split()(either the “nine” or the "eight"s are still visible), but this is the error that appears when I try to do both:
Traceback (most recent call last): File "script.py", line 5, in <module> decode1 =secret_message.split("nine").split("eight") AttributeError: 'list' object has no attribute 'split'
Why does this happen? Thank you!