I'm a beginner programmer and would like to know where to place my main function in python. I tried googling it but could not find any specific results. I don't think it really matters when you run the program but I was wondering if there was a proper format. Thanks.
There's no established convention, but I think that code is easier to read if the main logic is near the top of the file. I typically will define a main
at the top, and then call it from the very bottom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With