为什么会这样报错?
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
print(d)
alice_score= d.pop('Alice')
print(alice_score)
print(d)
for key in d.keys():
again=d.pop('Alice')
print(again)
print(d)
——————————————————————————————
Traceback (most recent call last): File "index.py", line 14, in again=d.pop('Alice') KeyError: 'Alice' {'Bob': 60, 'Ellena': 49, 'Alice': 45, 'Candy': 75, 'David': 86} 45 {'Bob': 60, 'Ellena': 49, 'Candy': 75, 'David': 86}