r/learnpython • u/TBRosati • Mar 05 '21
Jupyter Notebooks - Great tool for beginners
Just wanted to share with anyone who is struggling to learn AND implement code. I'm in my 4th week of Intro To Python and I have to say, I got a little overwhelmed. My teacher recommended using Jupyter Notebook (Google it, it's Free!) and it's helped out a shitload. Basically it's an open-source web app that allows you to share documents that contain live code. The BEST part is you can easily toggle between text for note-taking and code AND RUN THE CODE right in the document. This really changed the game for me and if you're out there struggling to bounce between your notes and your interpreter/compiler, check it out. Good luck
378
Upvotes
19
u/[deleted] Mar 05 '21
Beginners have this problem of coding in notebooks where they will do things like define a function in cell 3, use it in cell 2, and they have their notebook break next time they try to use it. They often fail to realize the only reason it worked before was because they ran the cells in a particular order. The user above was suggesting putting it all in a script at some point in order to avoid some of these confusions/bad practices.
I was pointing out that, rather than trying to define functions and classes inside your notebook, you should start by developing them in a script which is then automatically reimported into your notebook. This allows you to move things into the script bit by bit, rather than trying to move whole chunks all at once and running into many issues related to out of order execution, having to document everything with docstrings all at once at the end, doing all the testing at the end, etc etc.