Info db
InfoDb = []
InfoDb.append({
"FirstName": "Luka",
"LastName": "Van Den Boomen",
"DOB": "September 29",
"Residence": "San Diego",
"Email": "lukavdboomen@icloud.com",
"Hobbies": ["Soccer", "Videogames"]
})
print(InfoDb)
def print_data(d_rec):
print(d_rec["FirstName"], d_rec["LastName"])
print("\t", "Residence:", d_rec["Residence"])
print("\t", "Birth Day:", d_rec["DOB"])
print("\t", "Email:", d_rec["Email"])
print("\t", "Hobbies: ", end="")
print(", ".join(d_rec["Hobbies"]))
print()
# for loop algorithm iterates on length of InfoDb
def for_loop():
print("For loop output\n")
for record in InfoDb:
print_data(record)
for_loop()
def while_loop():
print("While loop output\n")
i = 0
while i < len(InfoDb):
record = InfoDb[i]
print_data(record)
i += 1
return
while_loop()
def recursive_loop(i):
if i < len(InfoDb):
record = InfoDb[i]
print_data(record)
recursive_loop(i + 1)
return
print("Recursive loop output\n")
recursive_loop(0)