辞書

ソースコード
#dictionary 2025/1/29
#coding:utf-8

person ={"name":"jhon","age":30}
print(person)

student = {"name":"山田","mathscore":87, "PGscore":90}
print(student)


person = dict(name="jhon",age=30)
print(person)

studet = dict(name="yamada",math=87,web=90)
print(student)


person = dict([("name","jhon"),("age",30)])
print(person)



student = dict([("name","yamada"),("max",88),("web",91)])
print(student)


student = {"name": "Alice", "math": 90}
print(f'studentname={student["name"]} score={student["math"]}')

print(student.get("pythonPG"),"no data")

student["pythonPG"]= 180
student["math"]= 31
print(student)



students ={
    "kane": {"age":22,"point":"A"},
    "devid": {"age":19,"point":"B"},
    "ashan":{"age":23,"point":"A"}
}
print(f'studentsname:{students}')
print(students["ashan"]["age"])
実行結果
Description of image