【发布时间】:2017-09-28 01:27:03
【问题描述】:
我有这个程序:
n = []
m = []
name = input("Enter student's names (separated by using commas) : ")
mark = input("Enter student's marks (separated by using commas) : ")
(n.append(name))
(m.append(mark))
total = 0
index = 0
while index < len(name) :
print("name:",name[index],'mark:',mark[index])
index +=1
结果是这样的:
Enter student's names (separated by using commas) : a,s,d
Enter student's marks (separated by using commas) : 1,2,3
name: a mark: 1
name: , mark: ,
name: s mark: 2
name: , mark: ,
name: d mark: 3
如何让它只出来这样:
Enter student's names (separated by using commas) : a,s,d
Enter student's marks (separated by using commas) : 1,2,3
name: a mark: 1
name: s mark: 2
name: d mark: 3
【问题讨论】:
标签: python-3.x while-loop