Quick actions

cmd+k|ctrl+k

Navigation

Languages

Exercise about Changing , Removing and Insert Method from the list

Snippet info

Language

Python

Visibility

public

Author

ericmash53

Created

2026-03-25T13:38:24.515529Z

Updated

2026-03-27T13:47:09.271662Z

                            # EXERCISE


# If you could invite anyone, living or deceased, to dinner, who would you invite? Make a list that includes at least three people you’d like to
# invite to dinner. Then use your list to print a message to each person, inviting them to dinner.

# SLOLUTION

invitation_people = ['Erick','Francis','Prisca','Praise'] # People those eho have been invited 


print('Good Eveining Mashaka Family. Yes I would like to invite 3 people that if its okay ')
print('and those are ', invitation_people , ' Please welcome to dinner with us')

# Changing Guest List: You just heard that one of your guests can’t make the dinner, so you need to send out a new set of invitations. You’ll have to think of
# someone else to invite.

# in this Valuable am going to write some people should be removed because of their Ages
# Some those will not be attended on the Dinner Party and Some will be attend in th Dinner Party New Guest

new_guest_1 = invitation_people.append('Monica') 
new_guest_2 = invitation_people.append('Joyce')
first_person = invitation_people.pop(2)
second_person = invitation_people.pop(0)
unwanted_guest = invitation_people.remove('Praise')
unwanted_guest_2 = invitation_people.remove('Francis')

# Now by THis Option Am Going To Show The How will Output will Bring Me The Answer

print('I just gotta a call that two of our guest will not come at our party dinner')
print()
print('Sorry for un-lately information. i just confirmed that two of our guest will not be attend on our Dinner party.')
print('And those are ' , first_person , 'and ', second_person )
print()
print('So our new Guest we will be attend with  to our Dinner Party and Those are' , invitation_people )

# Now i need to insert some of people are coming on the Dinner Party so that the Peop;e
# Those who there to The Dinner Party Should Be Confirmed and Recognised


invitation_people.insert(0,'Levocutus Ngunyale')
invitation_people.insert(1,'David Ngunyale ')

print('So Now i sincely to annouce that they will be more Guest will be attend on our Dinner Party')
print(' And now together They are ', invitation_people )


# Now i need to use del() statement in example of this so that i need to empty up my_list
INFO