0

I see many python scripts having the following main() code pattern below;

def main():
    print("Hello World!")


if __name__ == "__main__":
    main()

However, I have written many python scripts which do not have main() and I do not experience any problems without main(). When should one use main() in a python script, given that not having it seems to have no detrimental effect?

I am using python 3.8

user3848207
  • 2,659
  • 13
  • 40
  • 74

0 Answers0