Ask coding questions

← Back to all posts
What does this code do?
BrockTempler (0)

Idk how your even gonna see my code but I did click my repl.it that i want to display
at the top it will say if name == "main":
all the code is my'n but someone added that and I don't know why or what it does any one wanna tell me.
first time in talk.

Comments
hotnewtop
IMayBeMe (455)

If name == main is just a way to run the program. It will execute all the code underneath it as long as the file name is main

BrockTempler (0)

@IMayBeMe It would execute regardless theres no need for that. As long as it is meeting the parameters I give it, it works

IMayBeMe (455)

@BrockTempler Yeah it's generally unnecessary and I personally don't see a use for it.

BrockTempler (0)

And yes I know my code could be a lot simpler but I'm doing things with files on purpose.
Also please pray that I pass my MTA 98-381 exam tomorrow I just started coding and that test should be meant for next level of python teaching which they gonna do next year but its too hard for someone my level.

IMayBeMe (455)

@BrockTempler I’m kind a curious what is that test on, cause python can prob be learned in less than a week

BrockTempler (0)

@IMayBeMe Python is the first launguage I have ever learned but what were doing now is easy but on the test majority is stuff we have not learned at all. So much so that they are just now realizing it and next year the test is for the next level or advanced python class. PS. its a industry test so timed.

BrockTempler (0)

@IMayBeMe Also I didn't understand the first 2 '6' weeks of the class and just now started getting it since we went back full time I failed 2 days ago and I'm retaking it again today along with my drivers test except I didn't fail drivers test just first time. Alot of pressure.