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

Text based calculator in python

So I'm trying to write a text based calculator in python and I've run into an error. The code is at https://www.dropbox.com/s/4x34bfgop7a9ctz/calc.py?dl=0 When I run it, I get the error; ''' Traceback (most recent call last): File "calc.py", line 30, in <module> split(equ[1], equ[3]) IndexError: list index out of range ''' Please help!

I think python lists start at zero. This means you would want the 0th and 2nd element not the first and third.

split(equ[0], equ[2])

ill leave it to you to fix the next line.

1 Answer

Wow... I knew that, I just wasn't thinking about that when I wrote it. Thanks!