修正了错误注释

注释处的程序是正确的,原程序运行错误,得到的成绩表全都是最后一位学生的成绩
pull/407/head
Zpadger 2019-12-23 22:40:11 +08:00 committed by GitHub
parent eb2cb5f0fc
commit 645c3eed00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -11,18 +11,18 @@ def main():
names = ['关羽', '张飞', '赵云', '马超', '黄忠']
subjs = ['语文', '数学', '英语']
scores = [[0] * 3] * 5
for row, name in enumerate(names):
print('请输入%s的成绩' % name)
for col, subj in enumerate(subjs):
scores[row][col] = float(input(subj + ': '))
print(scores)
# for row, name in enumerate(names):
# print('请输入%s的成绩' % name)
# scores[row] = [None] * len(subjs)
# for col, subj in enumerate(subjs):
# score = float(input(subj + ': '))
# scores[row][col] = score
# print(scores)
# for row, name in enumerate(names):
# print('请输入%s的成绩' % name)
# for col, subj in enumerate(subjs):
# scores[row][col] = float(input(subj + ': '))
# print(scores)
for row, name in enumerate(names):
print('请输入%s的成绩' % name)
scores[row] = [None] * len(subjs)
for col, subj in enumerate(subjs):
score = float(input(subj + ': '))
scores[row][col] = score
print(scores)
if __name__ == '__main__':
main()