We all have those days where we're doubting ourselves and everything seems so difficult and practically impossible. For me, that was yesterday. When I was trying my best to follow along with the bootcamp's Javascript Tic-Tac-Toe video. I kept thinking to myself, how could I ever come up with this on my own? There are functions within functions and yet more functions everywhere! It's on those days that I particularly need the Codenewbie for some inspiration. I found out about this most adorable CSS game. Flexbox Froggy is now my new favourite game. It's a great way to kill time and just take your mind off impossible functions. You use CSS to move the little froggies to their lilypads. It reminds me of another game I love- Hoppers. Many an hour has been spent playing that game as well. <3 <3 <3
I've started on my Python course. So far, the code has been familiar because the first few basic codes are similar to Javascript. And then modules happened. Confusion and despair! What is the world is 'if __name__ == "__main__": ' and why must I reach this section of my course on a public holiday when none of the instructors are in :( Stack overflow to the rescue, providing me a lifeline while I was drowning in a pit of serpents. I feel eternally indebted to a particular Mr Fooz. Picture from here From my understanding, when the Python interpreter reads a source file, it first sets the variable __name__ and then it executes all the code in the file. If that particular file that you are running(i.e. your module) is the main program, the interpreter will assign '__name__ = "__main__" '. Thereafter, any code in the aforementioned 'if' statement is run. If you have, instead, imported a module, the interpreter assigns '__name__ ...
Comments
Post a Comment