students = {}
name = input("Give me the student name(key): ")
grade = input("What is their Grade(value): ")
'(输入字典键=名称和值=等级 从字典中打印所有学生及其成绩”
答案 0 :(得分:0)
students = {}
name = input("Give me the student name(key): ")
grade = input("What is their Grade(value): ")
students[name] = grade
您可以只使用students[key] = value
答案 1 :(得分:0)
下面的代码应该可以完成您的工作。有关如何添加到字典的详细信息,您可以参考上面共享的链接,也可以通过python文档查看。
students = {}
name = input("Give me the student name(key): ")
grade = input("What is their Grade(value): ")
students[name] = grade
print(students)