arr = []
for i in range(5):
arr.append(input("input name:"))
print("the names is ",end="")
for j in range(5):
print(arr[j],end=" ")
12-2
arr = []
for i in range(5):
arr.append(input("input name:"))
print("the names is ",end="")
for j in range(5):
print(arr[j],end=" ")
print("") #换行
new_list = arr.sort()
print("the names is ",end="")
for j in range(5):
print(arr[j],end=" ")
12-3
arr = []
for i in range(5):
arr.append(input("input name:"))
for j in range(5):
print(arr[j],end=" ")
print("")#换行
display = int(input("你想显示第几个名字,请输入数字(1-5):"))
print("the %d names is "%display,end="")
print(arr[display - 1])
12-4
arr = []
for i in range(5):
arr.append(input("input name:"))
for j in range(5):
print(arr[j],end=" ")
print("")#换行
changename = int(input("你想改变第几个名字,请输入数字(1-5):"))
arr[changename - 1] = input("请输入你要更换的名字:")
print("please output all name")
print("the names are ",end="")
for k in range(len(arr)):
print(arr[k],end=" ")
print("")
12-5
import easygui as gui
simple_dic = {}
while 1:
add_or_look = gui.enterbox("add or look up a word.(a/l): ")
if not add_or_look: #在(A/L)界面输入其他数字结束
break
if add_or_look == "a" or add_or_look == "l":
if add_or_look == "a":
word = gui.enterbox("请输入你要添加的单词:")
definition = gui.enterbox("请输入该单词的释义:")
simple_dic[word] = definition
gui.msgbox("word added")
else:
look_up_word = gui.enterbox("请输入要查询的单词:")
if look_up_word in simple_dic:
gui.msgbox(simple_dic[look_up_word])
else:
gui.msgbox("That word is not in the dictionary yet.")
else:
add_or_look = gui.msgbox("指令不正确,请重新输入。 ")
12-1arr = []for i in range(5): arr.append(input("input name:"))print("the names is ",end="")for j in range(5): print(arr[j],end=" ")12-2arr = []for i in range(5): arr.append(input(...