I'm doing the Automate the Boring Stuff with Python Book and am on page 139. I have to make a program to add a '*' in front of each line. However, my for loop doesn't seem to work here.
rawtextlist = [
'list of interesting shows',
'list of nice foods',
'list of amazing sights'
]
for item in rawtextlist:
item = '*' + item
My output is as such below. I am missing the '*' character in front of each line when using the code above.
list of interesting shows
list of nice foods
list of amazing sights
The answer provided in the book is as such.
for i in range(len(rawtextlist)):
rawtextlist[i] = '*' + rawtextlist[i]
The program only works for the answer provided in the book and not my for loop. Any help would be greatly appreciated!