# Syntax error (starter, very basic code)

**URL:** <https://discuss.python.org/t/syntax-error-starter-very-basic-code/6924>\
**Category:** Python Help\
**Tags:** help\
**Created:** [January 30, 2021, 6:57am UTC](https://discuss.python.org/t/syntax-error-starter-very-basic-code/6924 "2021-01-30T06:57:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vgwosdz](https://avatars.discourse-cdn.com/v4/letter/v/7cd45c/32.png) [@vgwosdz](https://discuss.python.org/u/vgwosdz)\
**Post date:** [January 30, 2021, 6:57am UTC](https://discuss.python.org/t/syntax-error-starter-very-basic-code/6924/1 "2021-01-30T06:57:40Z")

</div>

Hi, I am an absolute beginner and trying to write a simple program to calculate the average of 5 numbers.  
This is what I have come up with

_a, b, c, d, e = map(int, input(“Enter 5 numbers separated by space:”).split())_  
_average = (a + b + c + d + e)/5_  
_print ‘The average of the numbers is’, average_

However, I keep getting a syntax error. Can anyone point me in the right direction?

---

<div class="post-metadata">

**Author:** ![cameron](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/cameron/32/2658_2.png) [@cameron](https://discuss.python.org/u/cameron)\
**Post date:** [January 30, 2021, 7:55am UTC](https://discuss.python.org/t/syntax-error-starter-very-basic-code/6924/2 "2021-01-30T07:55:21Z")

</div>

Likely it is your print statement. You have:

```
print 'The average of the numbers is', average

```

In modern Python print() is a function, and you need to write it like  
this:

```
print('The average of the numbers is', average)

```

If the example code you are working with is old you may have to adjust  
all print statements into print() function calls.

Cheers,  
Cameron Simpson [cs@cskk.id.au](mailto:cs@cskk.id.au)

---

<div class="post-metadata">

**Author:** ![vgwosdz](https://avatars.discourse-cdn.com/v4/letter/v/7cd45c/32.png) [@vgwosdz](https://discuss.python.org/u/vgwosdz)\
**Post date:** [January 30, 2021, 8:39am UTC](https://discuss.python.org/t/syntax-error-starter-very-basic-code/6924/3 "2021-01-30T08:39:57Z")

</div>

> [@vgwosdz](#):
>
> _a, b, c, d, e = map(int, input(“Enter 5 numbers separated by space:”).split())_  
> _average = (a + b + c + d + e)/5_  
> _print ‘The average of the numbers is’, average_

Thanks! It was a double problem, I needed to update to a later version of python AND adjust the print command 😉
