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
  • 3,737
  • 17
  • 59
  • 104

0 Answers0