Hey Kinyanjui, you're absolutely right, the line does not have to be there.
If you want to use your script in two ways, execute it on its own and import it in another script, that's when you need to include if __name__ == '__main__':. Otherwise you don't need it.
if __name__ == '__main__':
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.