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: https://www.codecademy.com/courses/learn-python-3/informationals/python3-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”!