How to handle indentation in python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How to handle indentation in python.

As I started learning python recently...and from the background of programming languages like C++ and JAVA...so I am having some problem in it but the thing which is annoying me the most is it's indentation...like if I have made a code with loops and some if statements and then I want to handle exceptions with try and except...so i have to change all the indentation by adding tabs in each line...So I want to know is there a trick or a way to handle it. And one more help kindly tell me some free IDEs for python except of the python's official IDLE or shell

10th Oct 2018, 12:54 PM
Vansh Wadhwa
Vansh Wadhwa - avatar
10 Answers
+ 5
fra I downloaded it and it was free for 30days and after that it used to stop after 30mins
10th Oct 2018, 1:37 PM
Vansh Wadhwa
Vansh Wadhwa - avatar
+ 5
fra okkay...Thanks..I will check it and tell you if my problem is solved or not..;)
10th Oct 2018, 1:43 PM
Vansh Wadhwa
Vansh Wadhwa - avatar
+ 4
I'm not sure I understand the first part of your question. IMO indentation is an excellent requirement that prevents sloppy writing and was intentionally implemented by Guido with such a purpose in mind. Second - indentation is just a consequence of the program logic. So if you have a problem handling indentation there's a chance you have a problem with the clarity of the logic. BTW:I am convinced such enforced discipline should be a part of all programming languages. IDEs: there are many - it's a matter of personal preference. The first one that comes to my mind is PyCharm. If you're used to Eclipse then add Python to it. Scientists use Anaconda. This is a hit and miss game.
10th Oct 2018, 1:48 PM
Skipper
Skipper - avatar
+ 3
Skipper What exactly IMO indentation is...Is it the solution to the problem which I am facing??? And thanks for helping me out.
10th Oct 2018, 1:54 PM
Vansh Wadhwa
Vansh Wadhwa - avatar
+ 3
Skipper thanks ;)
11th Oct 2018, 1:07 AM
Vansh Wadhwa
Vansh Wadhwa - avatar
+ 2
Usually you can indent or dedent multiple lines by selecting them and hitting the tab key. A normal text editor will replace the selected text with a tab (not what you want). A python editor like Spyder will indent the selected lines. Same with dedentation (usually Ctrl + tab or Shift + tab).
10th Oct 2018, 5:06 PM
Anna
Anna - avatar
+ 2
Vansh Wadhwa Sure. IMO is an abreviation of "In my opinion" :) and is not any technical term. I'd suggest you open a new thread - this time with the code snippet that best illustrates the problem you're facing. Or edit your initial input that starts this thread by adding to it such a code.This will make the problem easier for everybody to understand and comment on. Good luck!
11th Oct 2018, 12:26 AM
Skipper
Skipper - avatar
+ 1
Try PyCharm, and IDE from jetbrains. It's free and it is really really good. It also manages the indentation for you, and a whole lot of other great stuff.
10th Oct 2018, 1:35 PM
fra
fra - avatar
+ 1
You probably downloaded the professional version. The community version is free. I'm still using one from 2016
10th Oct 2018, 1:39 PM
fra
fra - avatar
+ 1
10th Oct 2018, 1:44 PM
fra
fra - avatar