Standard Print:

Standard Print is only using the command print(InfoDb) to display InfoDb. This code doesn't separate the infomation very neatly.

InfoDb = []

# InfoDB is a data structure with expected Keys and Values

# Append to List a Dictionary of key/values related to a person and cars
#InfoDb.append({
#    "FirstName": "John",
#   "LastName": "Mortensen",
#    "DOB": "October 21",
#    "Residence": "San Diego",
#    "Email": "jmortensen@powayusd.com",
#    "Owns_Cars": ["2015-Fusion", "2011-Ranger", "2003-Excursion", "1997-F350", "1969-Cadillac"]
#})



# Append to List a 2nd Dictionary of key/values
#InfoDb.append({
#    "FirstName": "Sunny",
#    "LastName": "Naidu",
#    "DOB": "August 2",
#    "Residence": "Temecula",
#    "Email": "snaidu@powayusd.com",
#    "Owns_Cars": ["4Runner"]
    
#})


# Personal Info
InfoDb.append({
    "FirstName": "Lucas",
    "LastName": "Moore",
    "DOB": "December 16",
    "Age": "15",
    "HairColor": "Blonde",
    "Residence": "4S Ranch",
    "Email": "lem16silver@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Aniket",
    "LastName": "Chakradeo",
    "DOB": "Febuary 20",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "4S Ranch",
    "Email": "aniket@chakradeo.net",
    "Owns_Cars": ["Red-Buggati"]
})
InfoDb.append({
    "FirstName": "Ryan",
    "LastName": "Hakimipour",
    "DOB": "June 15",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "RyanHaki@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Soham",
    "LastName": "Kamat",
    "DOB": "March 9",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "sohamk10039@stu.powayusd.com",
    "Owns_Cars": ["None"]
})
# Print data structure
print(InfoDb)
[{'FirstName': 'Lucas', 'LastName': 'Moore', 'DOB': 'December 16', 'Age': '15', 'HairColor': 'Blonde', 'Residence': '4S Ranch', 'Email': 'lem16silver@gmail.com', 'Owns_Cars': ['None']}, {'FirstName': 'Aniket', 'LastName': 'Chakradeo', 'DOB': 'Febuary 20', 'Age': '15', 'HairColor': 'Black', 'Residence': '4S Ranch', 'Email': 'aniket@chakradeo.net', 'Owns_Cars': ['Red-Buggati']}, {'FirstName': 'Ryan', 'LastName': 'Hakimipour', 'DOB': 'June 15', 'Age': '15', 'HairColor': 'Black', 'Residence': 'San Diego', 'Email': 'RyanHaki@gmail.com', 'Owns_Cars': ['None']}, {'FirstName': 'Soham', 'LastName': 'Kamat', 'DOB': 'March 9', 'Age': '15', 'HairColor': 'Black', 'Residence': 'San Diego', 'Email': 'sohamk10039@stu.powayusd.com', 'Owns_Cars': ['None']}]

InfoDb For loop with output:

For loop results in the InfoDb becoming organized by their stand alone records. It creates the same output as InfoDb for loop with index, InfoDb while loop, and InfoDb recursion loop.

InfoDb = []

# InfoDB is a data structure with expected Keys and Values

# Append to List a Dictionary of key/values related to a person and cars
#InfoDb.append({
#    "FirstName": "John",
#   "LastName": "Mortensen",
#    "DOB": "October 21",
#    "Residence": "San Diego",
#    "Email": "jmortensen@powayusd.com",
#    "Owns_Cars": ["2015-Fusion", "2011-Ranger", "2003-Excursion", "1997-F350", "1969-Cadillac"]
#})



# Append to List a 2nd Dictionary of key/values
#InfoDb.append({
#    "FirstName": "Sunny",
#    "LastName": "Naidu",
#    "DOB": "August 2",
#    "Residence": "Temecula",
#    "Email": "snaidu@powayusd.com",
#    "Owns_Cars": ["4Runner"]
    
#})
    


# Personal Info
# Personal Info
InfoDb.append({
    "FirstName": "Lucas",
    "LastName": "Moore",
    "DOB": "December 16",
    "Age": "15",
    "HairColor": "Blonde",
    "Residence": "4S Ranch",
    "Email": "lem16silver@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Aniket",
    "LastName": "Chakradeo",
    "DOB": "Febuary 20",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "4S Ranch",
    "Email": "aniket@chakradeo.net",
    "Owns_Cars": ["Red-Buggati"]
})
InfoDb.append({
    "FirstName": "Ryan",
    "LastName": "Hakimipour",
    "DOB": "June 15",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "RyanHaki@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Soham",
    "LastName": "Kamat",
    "DOB": "March 9",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "sohamk10039@stu.powayusd.com",
    "Owns_Cars": ["None"]
})
# Print the data structure
#print(InfoDb)

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", "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 algorithm contains an initial n and an index incrementing statement (n += 1)
def for_incloop():
    print("for increment loop output\n")
    for i in range(0,len(InfoDb)):
        record = InfoDb[i]
        print_data(record)

for_incloop()
for increment loop output

Lucas Moore
	 Residence: 4S Ranch
	 Birth Day: December 16
	 Cars: None

Aniket Chakradeo
	 Residence: 4S Ranch
	 Birth Day: Febuary 20
	 Cars: Red-Buggati

Ryan Hakimipour
	 Residence: San Diego
	 Birth Day: June 15
	 Cars: None

Soham Kamat
	 Residence: San Diego
	 Birth Day: March 9
	 Cars: None

InfoDb For loop with Index output:

For loop with index results in the InfoDb becoming organized by their stand alone records. It creates the same output as InfoDb for loop, InfoDb while loop, and InfoDb recursion loop.

InfoDb = []

# InfoDB is a data structure with expected Keys and Values

# Append to List a Dictionary of key/values related to a person and cars
#InfoDb.append({
#    "FirstName": "John",
#    "LastName": "Mortensen",
#    "DOB": "October 21",
#    "Residence": "San Diego",
#    "Email": "jmortensen@powayusd.com",
#    "Owns_Cars": ["2015-Fusion", "2011-Ranger", "2003-Excursion", "1997-F350", "1969-Cadillac"]
#})



# Append to List a 2nd Dictionary of key/values
#InfoDb.append({
#    "FirstName": "Sunny",
#    "LastName": "Naidu",
#    "DOB": "August 2",
#    "Residence": "Temecula",
#    "Email": "snaidu@powayusd.com",
#    "Owns_Cars": ["4Runner"]
    
#})


# Personal Info
InfoDb.append({
    "FirstName": "Lucas",
    "LastName": "Moore",
    "DOB": "December 16",
    "Age": "15",
    "HairColor": "Blonde",
    "Residence": "4S Ranch",
    "Email": "lem16silver@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Aniket",
    "LastName": "Chakradeo",
    "DOB": "Febuary 20",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "4S Ranch",
    "Email": "aniket@chakradeo.net",
    "Owns_Cars": ["Red-Buggati"]
})
InfoDb.append({
    "FirstName": "Ryan",
    "LastName": "Hakimipour",
    "DOB": "June 15",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "RyanHaki@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Soham",
    "LastName": "Kamat",
    "DOB": "March 9",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "sohamk10039@stu.powayusd.com",
    "Owns_Cars": ["None"]
})
# Print the data structure
#print(InfoDb)

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", "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 algorithm iterates on length of InfoDb
def for_loop():
    print("For loop output\n")
    for record in InfoDb:
        print_data(record)

for_loop()
For loop output

Lucas Moore
	 Residence: 4S Ranch
	 Birth Day: December 16
	 Cars: None

Aniket Chakradeo
	 Residence: 4S Ranch
	 Birth Day: Febuary 20
	 Cars: Red-Buggati

Ryan Hakimipour
	 Residence: San Diego
	 Birth Day: June 15
	 Cars: None

Soham Kamat
	 Residence: San Diego
	 Birth Day: March 9
	 Cars: None

InfoDb while loop output:

While loop results in the InfoDb becoming organized by their stand alone records. It creates the same output as InfoDb for loop, InfoDb for loop with index, and InfoDb recursion loop.

InfoDb = []

# InfoDB is a data structure with expected Keys and Values

# Append to List a Dictionary of key/values related to a person and cars
#InfoDb.append({
#    "FirstName": "John",
#    "LastName": "Mortensen",
#    "DOB": "October 21",
#    "Residence": "San Diego",
#    "Email": "jmortensen@powayusd.com",
#    "Owns_Cars": ["2015-Fusion", "2011-Ranger", "2003-Excursion", "1997-F350", "1969-Cadillac"]
#})



# Append to List a 2nd Dictionary of key/values
#InfoDb.append({
#    "FirstName": "Sunny",
#    "LastName": "Naidu",
#    "DOB": "August 2",
#    "Residence": "Temecula",
#    "Email": "snaidu@powayusd.com",
#    "Owns_Cars": ["4Runner"]
    
#})


# Personal Info
InfoDb.append({
    "FirstName": "Lucas",
    "LastName": "Moore",
    "DOB": "December 16",
    "Age": "15",
    "HairColor": "Blonde",
    "Residence": "4S Ranch",
    "Email": "lem16silver@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Aniket",
    "LastName": "Chakradeo",
    "DOB": "Febuary 20",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "4S Ranch",
    "Email": "aniket@chakradeo.net",
    "Owns_Cars": ["Red-Buggati"]
})
InfoDb.append({
    "FirstName": "Ryan",
    "LastName": "Hakimipour",
    "DOB": "June 15",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "RyanHaki@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Soham",
    "LastName": "Kamat",
    "DOB": "March 9",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "sohamk10039@stu.powayusd.com",
    "Owns_Cars": ["None"]
})
# Print the data structure
#print(InfoDb)

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", "Cars: ", end="")  # end="" make sure no return occurs
    print(", ".join(d_rec["Owns_Cars"]))  # join allows printing a string list with separator
    print()

    # while loop algorithm contains an initial n and an index incrementing statement (n += 1)
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()
While loop output

Lucas Moore
	 Residence: 4S Ranch
	 Birth Day: December 16
	 Cars: None

Aniket Chakradeo
	 Residence: 4S Ranch
	 Birth Day: Febuary 20
	 Cars: Red-Buggati

Ryan Hakimipour
	 Residence: San Diego
	 Birth Day: June 15
	 Cars: None

Soham Kamat
	 Residence: San Diego
	 Birth Day: March 9
	 Cars: None

InfoDb recursion loop output:

Recursion loop results in the InfoDb becoming organized by their stand alone records. It creates the same output as InfoDb for loop, InfoDb for loop with index, and InfoDb while loop.

InfoDb = []

# InfoDB is a data structure with expected Keys and Values

# Append to List a Dictionary of key/values related to a person and cars
#InfoDb.append({
#    "FirstName": "John",
#    "LastName": "Mortensen",
#    "DOB": "October 21",
#    "Residence": "San Diego",
#    "Email": "jmortensen@powayusd.com",
#    "Owns_Cars": ["2015-Fusion", "2011-Ranger", "2003-Excursion", "1997-F350", "1969-Cadillac"]
#})



# Append to List a 2nd Dictionary of key/values
#InfoDb.append({
#    "FirstName": "Sunny",
#    "LastName": "Naidu",
#    "DOB": "August 2",
#    "Residence": "Temecula",
#    "Email": "snaidu@powayusd.com",
#    "Owns_Cars": ["4Runner"]
    
#})


# Personal Info
InfoDb.append({
    "FirstName": "Lucas",
    "LastName": "Moore",
    "DOB": "December 16",
    "Age": "15",
    "HairColor": "Blonde",
    "Residence": "4S Ranch",
    "Email": "lem16silver@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Aniket",
    "LastName": "Chakradeo",
    "DOB": "Febuary 20",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "4S Ranch",
    "Email": "aniket@chakradeo.net",
    "Owns_Cars": ["Red-Buggati"]
})
InfoDb.append({
    "FirstName": "Ryan",
    "LastName": "Hakimipour",
    "DOB": "June 15",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "RyanHaki@gmail.com",
    "Owns_Cars": ["None"]
})

InfoDb.append({
    "FirstName": "Soham",
    "LastName": "Kamat",
    "DOB": "March 9",
    "Age": "15",
    "HairColor": "Black",
    "Residence": "San Diego",
    "Email": "sohamk10039@stu.powayusd.com",
    "Owns_Cars": ["None"]  
})
# Print the data structure
#print(InfoDb)

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", "Cars: ", end="")  # end="" make sure no return occurs
    print(", ".join(d_rec["Owns_Cars"]))  # join allows printing a string list with separator
    print()

    # recursion algorithm loops incrementing on each call (n + 1) until exit condition is met
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)
Recursive loop output

Lucas Moore
	 Residence: 4S Ranch
	 Birth Day: December 16
	 Cars: None

Aniket Chakradeo
	 Residence: 4S Ranch
	 Birth Day: Febuary 20
	 Cars: Red-Buggati

Ryan Hakimipour
	 Residence: San Diego
	 Birth Day: June 15
	 Cars: None

Soham Kamat
	 Residence: San Diego
	 Birth Day: March 9
	 Cars: None