Event Coordinator Learn Intermediate Python 3

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with! → https://www.codecademy.com/courses/learn-intermediate-python-3/projects/int-python-event-coordinator




guests = {}
def read_guestlist(file_name):
  text_file = open(file_name,'r')
  while True:
    line_data = text_file.readline().strip().split(",")
    if len(line_data) < 2:
    # If no more lines, close file
    name = line_data[0]
    age = int(line_data[1])
    guests[name] = age
    guest_addition = yield name # modified code to create variable
    if guest_addition is not None:  # we know a guest addition has been passed in. 
      split_guest_addition = guest_addition.split(",")
      # we need to split the ["Jane, 35"] data first and store it in a variable.
      new_guest_name = split_guest_addition[0]
      # we take the newly created variable and store the 0 index into new guest name
      new_guest_age = int(split_guest_addition[1])
      # we take the newly creted variable and store the 1 index into the new guest age variable
      # we want to place jane in the guest dictionary. how did they do this look at line 12
      guests[new_guest_name] = new_guest_age # added new guest here
#input the name of the dictionary we want to update. 
# new_guest name is the "Jane" or the guest name that we want to add. it is the key that we want to input into the dictionary. and it updates the dictionary even though it is not being set on the right hand side of the equals sign. the new_guest_age value is the value side of the dictionary. we update the key and the value on the same line of code!

guest_list_generator = read_guestlist("guest_list.txt")
guest_index  = 0
for guest in guest_list_generator:
  # print(guest)
  guest_index += 1
  if guest_index >= 10:

for guest in guest_list_generator:
  print(guest) # Jane does not need to be on the list in this case per Mark.
guest_list_21_and_over = (name for name,age in guests.items() if age >= 21)
# print(list(guest_list_21_and_over))

def table_one():
  for iteration in range(1,6):
    yield ("Chicken", "Table 1", f"Seat {iteration}")
    yield ("Chicken", "Table 2", f"Seat {iteration}")
    yield ("Chicken", "Table 3", f"Seat {iteration}")
    yield ("Chicken", "Table 4", f"Seat {iteration}")
    yield ("Chicken", "Table 5", f"Seat {iteration}")

def table_two():
  for iteration in range(1,6):
    yield("Beef", "Table 1", f"Seat {iteration}")
    yield("Beef", "Table 2", f"Seat {iteration}")
    yield("Beef", "Table 3", f"Seat {iteration}")
    yield("Beef", "Table 4", f"Seat {iteration}")
    yield("Beef", "Table 5", f"Seat {iteration}")

def table_three():
  for iteration in range(1,6):
    yield("Fish", "Table 1", f"Seat {iteration}")
    yield("Fish", "Table 2", f"Seat {iteration}")
    yield("Fish", "Table 3", f"Seat {iteration}")
    yield("Fish", "Table 4", f"Seat {iteration}")
    yield("Fish", "Table 5", f"Seat {iteration}")

def combined_tables():
  yield from table_one()
  yield from table_two()
  yield from table_three()

def guest_assignment():
  for name in guests.keys:
    yield name, next(combined_tables)

guest_assignment= guest_assignment()
for person in guest_assignment:

Julian Edward Rose → not relevant it was from a prior step…

TypeError function object is not iterable

Instructions for Step 6:
Finally, we want to assign a table and seat number with meal selection to each guest. Create another generator function that will take in as input our guests dictionary and the connected generator seating/food selection we created in the previous step. This function should yield a tuple of the guest name and the next value from the connected generator.

The specific question that I have in my own words is: I believe that codecademy wants me to try to grab each persons name in the guests dictionary and than based on my understanding of these instructions I am supposed to yield a tuple with the guest name and the next value from the generator. I have created tables and placed them in a combined_tables generator I have also created a guest_assignment generator that iterates over the key values in the generator and yields the name after that, it needs to call next on another generator. I belive the solution would show the guests on the guest list being assigned tables and a tuple with the guest name and the next value for the generator but for some reason it is saying it is not iterable.

What steps have I taken to research this problem?
I have searched the codecademy fourms for the answers or a hint. they say
on this link that this is a valid answer: but I do not understand why my code does not work while the other one does: Learn Intermediate Python 3 - Python Event Coordinator Project - #8 by niko_oliver

I have researched the error type explanation:
I have looked at examples on Stack Overflow for similar problems

Can anyone help?

Hi there! It looks like you have a syntax error. Recall that .keys is a Python method.

Hope this helps!