Jun-01-2026, 06:19 PM
(This post was last modified: Jun-01-2026, 07:38 PM by Gribouillis.)
Hi all,
I'm just going through the "automate the boring stuff" workbook chapter 4. I cannot get my head around how "bacon local" is printed first? (Any help greatly appreciated!)
I'm just going through the "automate the boring stuff" workbook chapter 4. I cannot get my head around how "bacon local" is printed first? (Any help greatly appreciated!)
def spam():
eggs = 'spam local'
print(eggs) # Prints 'spam local'
def bacon():
eggs = 'bacon local'
print(eggs) # Prints 'bacon local'
spam()
print(eggs) # Prints 'bacon local'
eggs = 'global'
bacon()
print(eggs) # Prints 'global'OUTPUTOutput:bacon local
spam local
bacon local
global
Gribouillis write Jun-01-2026, 07:38 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
