This is very basic issue with me right now. I don't know how to write a function or class in python. I mean i know the syntax but i don't know how to escape from the indentation while typing on IDLE.

For example

def sum():
    var1=10;
    var2=20;
    sum=var1+var2;

#how to get to this line in IDLE? to write comment or further statements?

now i want to escape from the indentation and call the function wihout causing the function to break and IDLE is throwing error when i do that. I know this is very simple issue but i just can't get my hands on jusing the IDLE or say python code in command line which i want to write.

Is there any tut on web that lets me know how to use command line python effectively or say using IDLE effectively? I know i should be using IDE to save time and all but this is something too hard to miss if i'm learning python.

You are typing your function to new window in IDLE, by Ctrl-N or File - New Window aren't you? Then you can just choose to run the file with F5 or choose Run - Run Module from menu.

I figured it out it's backspace to go to new line. I know it was silly question but have to test a lot for this. Thanks for the help. I don't know if this is same in the command line or say bash prompt? have to test that.

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.