# Define an empty List called InfoDb
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"]
})

# Append to List a 2nd Dictionary of key/values
InfoDb.append({
    "FirstName": "Shane",
    "LastName": "Lopez",
    "DOB": "February 27",
    "Residence": "San Diego",
    "Email": "???@powayusd.com",
    "Owns_Cars": ["2021-Insight"]
})

# Append to List a 2nd Dictionary of key/values
InfoDb.append({
    "FirstName": "Sri Vaidya",
    "LastName": "S",
    "DOB": "December 18",
    "Residence": "San Diego",
    "Email": "srivaidyanathan65850@stu.powayusd.com@powayusd.com",
    "Owns_Cars": ["Honda-CRV"]
})

# Append to List a 2nd Dictionary of key/values
InfoDb.append({
    "FirstName": "Saathvik",
    "LastName": "Gampa",
    "DOB": "August 3rd",
    "Residence": "San Diego",
    "Email": "???@powayusd.com",
    "Owns_Cars": ["Acura RDX, and Honda CRV"]
})


# Print the data structure
print(InfoDb)
[{'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']}, {'FirstName': 'Sunny', 'LastName': 'Naidu', 'DOB': 'August 2', 'Residence': 'Temecula', 'Email': 'snaidu@powayusd.com', 'Owns_Cars': ['4Runner']}, {'FirstName': 'Shane', 'LastName': 'Lopez', 'DOB': 'February 27', 'Residence': 'San Diego', 'Email': '???@powayusd.com', 'Owns_Cars': ['2021-Insight']}, {'FirstName': 'Sri Vaidya', 'LastName': 'S', 'DOB': 'December 18', 'Residence': 'San Diego', 'Email': 'srivaidyanathan65850@stu.powayusd.com@powayusd.com', 'Owns_Cars': ['Honda-CRV']}, {'FirstName': 'Saathvik', 'LastName': 'Gampa', 'DOB': 'August 3rd', 'Residence': 'San Diego', 'Email': '???@powayusd.com', 'Owns_Cars': ['Acura RDX, and Honda CRV']}]
# This jupyter cell has dependencies on one or more cells above

# print function: given a dictionary of InfoDb content
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", "Email", d_rec["Email"])
    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) # call to function

for_loop() # call to function
For loop output

John Mortensen
	 Residence: San Diego
	 Birth Day: October 21
	 Email jmortensen@powayusd.com
	 Cars: 2015-Fusion, 2011-Ranger, 2003-Excursion, 1997-F350, 1969-Cadillac

Sunny Naidu
	 Residence: Temecula
	 Birth Day: August 2
	 Email snaidu@powayusd.com
	 Cars: 4Runner

Shane Lopez
	 Residence: San Diego
	 Birth Day: February 27
	 Email ???@powayusd.com
	 Cars: 2021-Insight

Sri Vaidya S
	 Residence: San Diego
	 Birth Day: December 18
	 Email srivaidyanathan65850@stu.powayusd.com@powayusd.com
	 Cars: Honda-CRV

Saathvik Gampa
	 Residence: San Diego
	 Birth Day: August 3rd
	 Email ???@powayusd.com
	 Cars: Acura RDX, and Honda CRV

Iterating through loops with an Index

my_list = ["iPhone", "iPad", "iWatch", "iMac"]

# Initialize a loop that iterates through indices (0, 1, 2, 3)
for index in range(len(my_list)):
    # Access the element at the current index
    fruit = my_list[index]
    # Process the element (printing in this case)
    print(f"Index {index}: {fruit}")

Index 0: iPhone
Index 1: iPad
Index 2: iWatch
Index 3: iMac