Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

List Function error

Hi all, im having an error when im trying to make a simple list to follow along my python teacher.

treehouse:~/workspace$ a_list = list('abzde') bash: syntax error near unexpected token `('

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

You are trying to execute Python at a bash shell prompt in the console window.

Create a file in the workspace, say code.py, save it, then type

python code.py

at the bash prompt.

If you want to start the python REPL, simply type python

treehouse:~/workspace$ python
Python 3.5.0 (default, Nov 26 2015, 16:04:52) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on unknown
Type "help", "copyright", "credits" or "license" for more information.
>>> a_list = list('abzde')
>>> a_list
['a', 'b', 'z', 'd', 'e']

Many thanks for your fast response,i really appreciate that