+ 2
Please try and search just so that we can avoid duplicates but this is from 2 years ago so I can see how it was missed. See this question from another:
https://www.sololearn.com/Discuss/2823102/?ref=app
Also, this video gives a good "why" reason which is what you're looking for:
https://youtu.be/o4XveLyI6YU
Also, see this from FCC with some examples of "when": https://www.freecodecamp.org/news/if-name-main-JUMP_LINK__&&__python__&&__JUMP_LINK-example/
Another source for stating how it's good for testing:
https://note.nkmk.me/en/python-if-name-main/
0
Мурод