Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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
Chris Freeman
Treehouse Moderator 67,989 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