# take the number as input number = int(input()) while number <= 0: print(number) number = number - 1
How to solve the indent error from this code. I couldn't solve this in python
keep in mind that indentation in python is very important because it tells the interpreter when the block of code has starts and when it ends. whenever it encounters a newline after indentation it means block is ended. you must always use spaces for indentation instead of tabs. and it should be consistent throughout your program. According to convention you must use 4 spaces to indent your code.
I think you should use >= 0 cause if you give <= 0 this means user should enter -ve numbers but I see you are trying to decrease the number so you expect +ve input hence use >=0 instead of <=0
arooj amina Delete all the indents and then reindent again with equal number of spaces.
While Ratnapal Shende's advice is good, there's no such requirement to always use spaces for indentation. Just be consistent, and use either only spaces or only tabs.
arooj amina The problem with your code is not the indentation, if you copy it into Code Playground, you'll see it works just fine, with no error. But the problem is with the logic. It either don't output anything or goes into an infinite loop. As Snehil pointed out you messed with the comparison operator.
Just remove the indention on the last line.