Aug-19-2018, 08:02 AM
This is the code I wrote initially,
So I modified the code this way:
It would be great if you could explain this to me.
Thanks
print("Once upon a time, 5 men were walking by the forest") warriors = ["Kevin", "Casper", "Nick", "Jim", "Napolean"] print("The names of these men were: " + (warriors))However, it gives TypeError : can only concatenate str (not "list") to str
So I modified the code this way:
print("Once upon a time, 5 men were walking by the forest") warriors = ["Kevin", "Casper", "Nick", "Jim", "Napolean"] print("The names of these men were: " + str(warriors))And now its working fine, but I don't understand why
It would be great if you could explain this to me.
Thanks