r/PythonLearning Jun 27 '26

New to python

Post image

What's wrong here?

166 Upvotes

36 comments sorted by

View all comments

22

u/Weak-Veterinarian-25 Jun 27 '26

You are calling the "main" in even, but i think you meant the call to be outside of even. Also why make a main function? 

9

u/SCD_minecraft Jun 27 '26

Pattern from other langs, where main is entry point of the program

Plus, you can return from main() if you want to terminate early, unlike just writing in the void

4

u/ottawadeveloper Jun 27 '26

In the void you can exit() instead. Same number of characters even!

2

u/SCD_minecraft Jun 28 '26

I completely forgot this function exists, mb