List and Dictionary Hacks
Week 2 Hacks.
InfoDb = []
InfoDb.append({
"First Name": "Tanay",
"Last Name": "P.",
"DOB": "July 24",
"Residence": "San Diego",
"Favorite Food":"Enchiladas",
"Owns Cars": "all em because I got racks on racks."
})
InfoDb.append({
"First Name": "Yuri",
"Last Name": "S.",
"DOB": "January 3",
"Residence": "San Diego",
"Favorite Food":"Burgers",
"Family Members": "4",
"Owns Cars": "none"
})
print(InfoDb)
for elem in InfoDb:
print(elem)
for key in elem:
print(key)
print(elem[key])
for i in range(len(InfoDb)):
print(InfoDb[-(i+1)])
listofdic = ({
"Bill Russel has won the most NBA championships in history. How many championships has he won?": "11",
"What was the last year that the Sacramento Kings made the playoffs?": "2006",
"Which NBA player holds the all-time record for the most total assists?": "John Stockton",
})
score = 0
for key, value in listofdic.items():
questions = input(key)
if questions == value:
print("Correct")
score +=1
else:
print("Incorrect")
print(score)