Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

raviraj619

  • 3 years ago

there is always a problem in idle while using 'else'. it gives indentation error. please help

  • This Question is Closed
  1. Joet99
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Make sure you use tab to indent the IF and ELSE sections. I am assuming this is Python. You might have to paste your code snippet.

  2. raviraj619
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    "unindent does not match any outer indentation level" this the t shows always, i have tried in different ways.

  3. TuringTest
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    it should be like so if <boolean>: <code> else: <code>

  4. raviraj619
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    >>> x=35 >>> if x==35: print 'true' else: File "<pyshell#3>", line 3 else: ^ IndentationError: unindent does not match any outer indentation level

  5. TuringTest
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    well, the way you copy-pasted it I can't tell how your indents are written, the >>> is throwing me off.

  6. raviraj619
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    x=35 if x==35: print 'true' else: File "<pyshell#3>", line 3 else: ^ IndentationError: unindent does not match any outer indentation level

  7. TuringTest
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    I hope you're not typing this directly into the shell. Open a new window with CTRL+N and type in your program, then run it with F5. If that doesn't work, copy paste that code here so we can see the indentation properly, the >>> from the shell is making it hard to see what you actually typed.

  8. raviraj619
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thank you so much. its is very helpful,and it is woking

  9. TuringTest
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    glad that's all it was :)

  10. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy