Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IndentationError
#1
Hi All,

I'm new to python. Could you please help me why I'm getting error?

def main():
    print ("Hello world")
 if __name__ == "__main__":

main()
I'm getting below error

Error:
File "main.py", line 14 main() ^ IndentationError: expected an indented block
Reply
#2
def main():
    print ("Hello world")
if __name__ == "__main__":
    main()
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  IndentationError: unexpected indent dee 3 2,330 May-02-2022, 02:15 AM
Last Post: dee
  error "IndentationError: expected an indented block" axa 4 2,932 Sep-08-2020, 02:09 PM
Last Post: ibreeden
  IndentationError: unexpected indent jk91 1 2,393 Feb-27-2020, 08:56 PM
Last Post: buran
  IndentationError: expected an indented block ryder5227 2 2,622 Sep-27-2019, 06:59 PM
Last Post: jefsummers
  IndentationError on installed package evvvonder 3 3,046 Jun-29-2019, 10:30 PM
Last Post: Gribouillis
  how do i fix this problem - IndentationError? GrandMaster101 8 7,719 Apr-04-2019, 09:38 PM
Last Post: carloszoom3000
  Indentationerror Jack_Sparrow 4 4,220 May-16-2018, 05:50 PM
Last Post: Jack_Sparrow
  IndentationError message could be confusing to new programmers insearchofanswers87 1 2,352 May-16-2018, 05:05 PM
Last Post: Larz60+
  IndentationError: unexpected indent (Python) segs 8 17,303 Aug-11-2017, 03:13 PM
Last Post: segs

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020