Force formatting

I probably could find the answer if I go back and review the lesson on .format() but wanted to post in the forum in case someone can quickly and easily answer my question regarding Step 12 in the Off-platform project, Abruptly Goblins:

Why am I not supposed to force format (sorry I don’t remember the correct terminology) game="Abruptly Goblins"? Please see my code below and the resulting NameError message …

def send_email(gamers_who_can_attend, day, game):
    for gamer in gamers_who_can_attend:
        print(form_email.format(name=gamer['name'], day_of_week=day, game="Abruptly Goblins"))
send_email(attending_game_night, game_night, game)
NameError                                 Traceback (most recent call last)
Cell In[62], line 5
      2     for gamer in gamers_who_can_attend:
      3         print(form_email.format(name=gamer['name'], day_of_week=day, game="Abruptly Goblins"))
----> 5 send_email(attending_game_night, game_night, game)

NameError: name 'game' is not defined

The NameError message says I did not define ‘game’. But I did! I made it equal to “Abruptly Goblins”!

This isn’t a .format() issue, this is a variable scope issue. game is defined within/inside the function so it’s a local variable. You’re trying to access something via print() which is’t available outside.

So, how would you fix that?