InfoDb = []
# Append to List a Dictionary of key/values related to a person and cars
InfoDb.append({
"FirstName": "Khalid",
"LastName": "Farah",
"DOB": "July 7th 2006",
"Residence": "San Diego, California",
"Email": "Khalidfarah211@gmail.com",
"Owns_Cars": ["None yet their on the way"],
"Pets": "No pets thankfully",
"Siblings": "One brother with an age of 21 and a sister who is 19 years old"
})
def print_data(d_rec):
print(d_rec["FirstName"], d_rec["LastName"]) # using comma puts space between values
print("\t", "Residence:", d_rec["Residence"]) # \t is a tab indent
print("\t", "Birth Day:", d_rec["DOB"])
print("\t", "Pets owned:", d_rec ["Pets"])
print("\t", "Siblings:", d_rec ["Siblings"])
print("\t", "Cars: ", end="") # end="" make sure no return occurs
print(", ".join(d_rec["Owns_Cars"])) # join allows printing a string list with separator
print()
# for loop iterates on length of InfoDb
def for_loop():
print("For loop output\n")
for record in InfoDb:
print_data(record)
for_loop()