enter code here
I'm reading 'Python Crash Course', and i made a simple list of people to invite to dinner. I had remove, add and replace a name on the list, problem is: When i try to print the updated/new list of people, i get this Error, i tried everything i could think of:
AttributeError: 'list' object has no attribute 'title'
I changed the variable name "Dinner", double-checked every use of Variables. I can't figure out what the error is.
___________________________________________
Dinner = ["Emiel", "Louie", "Ben", "Jim", "Ant"]
Invite_Emiel = "Hello" + " " + Dinner[0] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Emiel)
Invite_Louie = "Hello" + " " + Dinner[1] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Louie)
Invite_Ben = "Hello" + " " + Dinner[2] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Ben)
Invite_Jim = "Hello" + " " + Dinner[3] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Jim)
Invite_Ant = "Hello" + " " + Dinner[4] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Ant)
cant_go = Dinner[1] + " " + "Can't go to the party, he called, his daughter died.\n"
print(cant_go)
Dinner_remove = Dinner.remove('Louie')
Dinner_add = Dinner.insert(1, 'Chris')
New_People = "Here's the list for the people coming to dinner:" + " " + Dinner.title()
print(Dinner)
Full-Error:
Traceback (most recent call last):
File "C:\Users\Tyler\Desktop\PCC TS\pcc.py", line 28, in <module>
New_People = "Here's the list for the people coming to dinner:" + " " + Dinner.title()
AttributeError: 'list' object has no attribute 'title'
Like i said, i don't have any ideas on what's wrong or how to fix it.