guests = ['Megatron', 'Elvis', 'Jesus', 'Shaq'] mega_guest = guests[0] + "," + " " + "would you like to have dinner at my place at 7 PM?" elvis_guest = guests[1] + "," + " " + "would you like to have dinner at my place at 7 PM?" jesus_guest = guests[2] + "," + " " + "would you like to have dinner at my place at 7 PM?" shaq_guest = guests[3] + "," + " " + "would you like to have dinner at my place at 7 PM?" print(mega_guest) print(elvis_guest) print(jesus_guest) print(shaq_guest) print(guests[3] + " " + "cannot make the dinner at 7. \nHe has to film the new Gold Bond commercial.") # Changing Guest List guests[3] = "Dino Supmoni" print("Hello" + " " + mega_guest + " " + "We're having pork chops!") print("Hello" + " " + elvis_guest + " " + "We're having pork chops!") print("Hello" + " " + jesus_guest + " " + "We're having pork chops!") print("Hello" + " " + guests[3] + "," + "would you like to have dinner at my place at 7 PM?" + " " + "We're having pork chops!") # More Guests guests.insert(0, "Jon Snow") guests.insert(2, "Homer Simpson") guests.append("Gandalf") print("Hello" + " " + guests[0] + "," + " " + "would you like to have dinner at my place at 7 PM? " + " " + "We're having pork chops!") print("Hello" + " " + guests[1] + "," + " " + "would you like to have dinner at my place at 7 PM? " + " " + "We're having pork chops!") print("Hello" + " " + guests[2] + "," + " " + "would you like to have dinner at my place at 7 PM? " + " " + "We're having pork chops!") print("Hello" + " " + guests[3] + "," + " " + "would you like to have dinner at my place at 7 PM? " + " " + "We're having pork chops!") print("Hello" + " " + guests[4] + "," + " " + "would you like to have dinner at my place at 7 PM? " + " " + "We're having pork chops!") print("Hello" + " " + guests[5] + "," + " " + "would you like to have dinner at my place at 7 PM? " + " " + "We're having pork chops!") print("Hello" + " " + guests[6] + "," + " " + "would you like to have dinner at my place at 7 PM? " + " " + "We're having pork chops!") uninvited_1 = guests.pop(0) print(uninvited_1) uninvited_2 = guests.pop(1) print(uninvited_2) uninvited_3 = guests.pop(2) print(uninvited_3) uninvited_4 = guests.pop(3) print(uninvited_4)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question