from pprint import pprint
import json
student = {
    "name" : "Jan Kowalski",
    "age": 22,
    "courses": ["Math," "Science"]
}

# print(student.get("name"))
# print(student.get("nam"))

# print(student["age"])
# # print(student["ae"])

print(student.values())
for value in student.values():
    print(value)


# print(student.keys())
# print(student.items())

# # nazwa_gry, data_wydania, "wydawca", "gatunek"



# gra = {
#     "nazwa_gry": "Wiedźmin 3",
#     "data_wydania": 2015,
#     "wydawca": "CDProjekt Red",
#     "gatunek":"RPG"
# }
# pprint(gra)
# gra.setdefault("PEGI", 18)
# print(gra) 

# delted = gra.pop("wydawca")
# pprint(delted) 

# last_deleted = gra.popitem()
# pprint(last_deleted) 

# try:
#     del gra["dta_wydania"]
#     pprint(gra)
# except:
#     print("Nie znaleziono takiego klucza")

# gra.clear()
# print(gra)

# potegi = {}

'''
{
    0:0
    1:1
    2:4
    3:9
    4:16
    .
    .
    .
    10:100
}

'''

# for i in range(11):
#     potegi.setdefault(i, i**2)

# pprint(potegi)

# gra = {
#     "nazwa_gry": "Wiedźmin 3",
#     "data_wydania": 2015,
#     "wydawca": "CDProjekt Red",
#     "gatunek":"RPG"
# }

# #odczyt pliku spis_gier.json
# with open("spis_gier.json", "w") as file:
#     spis_gier = json.load(file)

# spis_gier["spis_gier"].append(gra)
# print(spis_gier)

#zapis do pliku spis_gier2.json (plik jest tworzony na nowo, w przeciwnym
#wypadku, jest nadpisywany)
# with open("spis_gier2.json", "w") as file:
#     json.dump(spis_gier, file, indent=4, sort_keys=True)

# with open("spis_gier2.json", "r") as file:
#     spis_gier2 = json.load(file)
# print(spis_gier2)