python字典的书写方法

def get_student(GPA,student_record):
      names=[]
      return names
_input=input()
GPA,student_record=_input.split('  ',1)
student_record=eval(student_record)
names=get_student(GPA,student_record)
names.sort()
print(str(names))

以上是代码,需要填充函数里的内容。
函数的input是下面图片的。感觉输入不能满足源代码的需求。

img

先搞清楚函数要返回什么,如果是指把名字返回的话,return list(student_record.keys()) 就可以了

直接exec(input())就好了,把输入整个当代码执行
然后
student_record1=locals()['student_record']
注意不要同名,否则会覆盖了,取不到数据了