I just downloaded and installed ActivePython on my windows PC (XP).

I can bring up the editor and can write very beginner lines of code in the editor and save and run the program.

However, when I create any function the interpreter says there is an error, no matter how trivial the function is.
for example
-def X(a,b):
a+b
I put the dash in there to show that the interpreter thinks there is an error.

I also can not create multiline dictionaries such as
-x = {"a":"c" , \
"b":"d", \
}


Question: why does my interpreter think these are errors when this code, and code very similar to it, are copied directly from manuals and other help for beginner documents.

AND: why does the interpreter appear to be so dumb? it reports an error on the line, but I can not find out why it thinks there is an error there. In all the help documentation I have read, there is nothing that says what the dashes are. I am assuming these indicate errors, but I dont really know. I certainly can not run a program that contains these. In all the help references I have read, none of them say anything about how to use the interpreter, they just say that this is an interpreted language.

I have used other interpreted languages that tell me what the problem might be, perhaps I was spoiled.

Thanks for the help.

Not nearly enough info. You'll have to include the code (using code tags because whitespace counts in python-see the "Please use BB Code and Inlinecode tags" thread) and a complete error message
For starters, your code should read

def X(a,b):
   c = a+b

##   note that the backslash is not necessary
x = {"a":"c" , \
       "b":"d"
      }

Woooee, thanks for responding.

Sorry about not putting in the correct indentations, but even with those, using the code you have rewritten in the reply, I get the errors shown in my post.

I dont know why the interpreter thinks the syntax is incorrect, and it tells me nothing about what may be the problem.

The Python interpreter is used for simple stuff, mostly one liners. You have to press the Enter key after every line you write, so the interpreter display would look something like this:

>>> def add(a, b):
...     return a + b
... 
>>> add(1, 3)
4
>>>

Ugly stuff to read and do! Use an editor to write your code , save it as for instance mycode.py and then run the file. Here is your editor code:

def add(a, b):
    return a + b

print add(1, 3)  # will display 4

Click on 'toggle plain text' to get away from the line numbers, then highlight and copy the code to your editor.

For editor use IDLE that comes with your Python installation. See:
http://www.daniweb.com/forums/post104834-1.html

This code works, but I still get the dash from the interpreter. What does this dash mean? I thought it meant an error, but apparently I am wrong.

All of my code has been written in the IDLE editor. Doesnt the interpreter work with the IDLE editor? If not, how do you find your errors?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.