两个问题的代码都帮你写出来了,其中都有“输入的合法性校验”,这样可以提高程序的健壮性。有不明白的地方可以继续提问。问题(2):def initList():
'Function : initList for initing the list for program.'
theList=['','','','','',.......................]
# Init your list for this program.
return theListdef outPut(List):
'Function : output the result for client.'
while ...
我也是python初学者,这个问题可以用如下代码解决:list1=['a','b','c','d','e','f','g','h','i','j']#列表中字母可替换成相应的文字项目list2=[]n=range(10)for i in n: input=raw_input('please enter a number:')
#请...