# Problem with code in book

**URL:** https://forum.codeselfstudy.com/t/problem-with-code-in-book/3191
**Category:** General Discussion
**Created:** [June 29, 2026, 5:00am UTC](https://forum.codeselfstudy.com/t/problem-with-code-in-book/3191 "2026-06-29T05:00:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![robinclaire](https://forum.codeselfstudy.com/user_avatar/forum.codeselfstudy.com/robinclaire/32/5285_2.png) [@robinclaire](https://forum.codeselfstudy.com/u/robinclaire)
#### Post date: [June 29, 2026, 5:00am UTC](https://forum.codeselfstudy.com/t/problem-with-code-in-book/3191/1 "2026-06-29T05:00:13Z")

</div>

```python
def spam():
eggs = 'spam local'
print (eggs(

def bacon():
eggs = 'bacon local'
print (eggs)
spam()
print (eggs)

eggs = 'global'
bacon()
print (eggs)

```

---

<div class="post-metadata">

### Author: ![Josh](https://forum.codeselfstudy.com/user_avatar/forum.codeselfstudy.com/josh/32/4_2.png) [@Josh](https://forum.codeselfstudy.com/u/Josh)
#### Post date: [June 29, 2026, 5:10am UTC](https://forum.codeselfstudy.com/t/problem-with-code-in-book/3191/2 "2026-06-29T05:10:39Z")

</div>

> [@robinclaire](#):
>
> `print (eggs(`

There’s an error with the closing parenthesis. It should be `print(eggs)`

Also, Python depends on indentation. The body of a function should be indented by four spaces.

Here’s a working version:

```python
def spam():
    eggs = 'spam local'
    print(eggs)

def bacon():
    eggs = 'bacon local'
    print(eggs)
    spam()
    print(eggs)

eggs = 'global'
bacon()
print(eggs)

```

Let us know if you have more questions.
