"""name1 = str(raw_input("Enter 5 names, one at a time. ")) name2 = str(raw_input()) name3 = str(raw_input()) name4 = str(raw_input()) name5 = str(raw_input()) name_list = [] name_list.extend([name1, name2, name3, name4, name5]) print "The names are", for i in range(0, 4): current_name = name_list.pop() print current_name,",", print "and", current_name = name_list.pop() print current_name,"." #V2====================================================================== name1 = str(raw_input("Enter 5 names, one at a time. ")) name2 = str(raw_input()) name3 = str(raw_input()) name4 = str(raw_input()) name5 = str(raw_input()) name_list = [] name_list.extend([name1, name2, name3, name4, name5]) print "The third name is: ", for i in range(0, 3): current_name = name_list.pop() current_name = name_list.pop() print current_name,"." #V3=======================================================================""" name1 = str(raw_input("Enter 5 names, one at a time. ")) name2 = str(raw_input()) name3 = str(raw_input()) name4 = str(raw_input()) name5 = str(raw_input()) name_list = [] name_list.extend([name1, name2, name3, name4, name5]) name_list2 = name_list[:] print "The names are", for i in range(0, 4): current_name = name_list.pop() print current_name,",", print "and", current_name = name_list.pop() print current_name,"." print name_list2 place = int(raw_input("Replace one name. Which one? (0-4) ")) replace = str(raw_input("New name: ")) print name_list2 del name_list2[place] name_list2.insert(place, replace) print name_list2
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