自动检测Alice成绩,并保存旧成绩输出新成绩
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
if 'Alice' in d.keys():
print('Alice old score is ' + str(d['Alice']))
d['Alice'] = 60
print('Alice new score is ' + str(d['Alice']))
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
if 'Alice' in d.keys():
print('Alice old score is ' + str(d['Alice']))
d['Alice'] = 60
print('Alice new score is ' + str(d['Alice']))
2021-01-25
举报