Create a dictionary and use the .get() dictionary method to safely access the value of a key in the dictionary. Include a default value in your method call.
.get()
.get() info
students = [("Alice", 16), ("Bob", 17), ("Cathy", 15)] for name, age in students: print(name, "is", age)
books = [ {"title": "1984", "author": "Orwell"}, {"title": "Dune", "author": "Herbert"} ] for book in books: print(book["title"], "by", book["author"])
classroom = { "students": ["Alice", "Bob", "Cathy"], "grades": [90, 85, 92] } print(classroom["students"])
Write a program that:
name
score