While you're here



File "python", line 9
IndentationError: expected an indented block

The "break" invocation is inside the loop I do not understand why I am getting an indentation error message.

<img src="//codecademy-discourse.s3.amazonaws.com/original/5X/8/c/8/6/8c868b01cdedeb9cbd32c2f805ca78274cbe7e1f.png" width="690" height="255">

count = 0

if count < 5:
    print "Hello, I am an if statement and count is", count
    while count < 5:
        print "Hello, I am a while and count is", count
    count += 1
    if count == 9:


The while loop should be outside the if condition.


^ and you need to pay attention to your indentation. python relies on various indentation levels to read your code properly


I ended up getting the code to work but I am still having some difficulty wrapping my head around indentation for conditionals, I figure the more I get through the loops set the more I'll understand thanks for the feedback.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.