i have a problem when i use jupyter with python it keeps shows me errors and i dont know why. i see the instructor in the videos didnt have any error like the one that i have even though i followed his instructions.
Please watch a tutorial on how Jupiter Notebook works.
The error happens because the code is executed in cells - meaning whenever you run a cell, that code is given to the Interpreter and you can imagine it as having a Python document in the background, where whenever you run a cell, that code is added to the document.
Left of your code, see the  ? This number counts up for every cell you run. In this case, it means this is the FIRST cell you run.
So what would happen if you start a Python document and write “more_fruits”? Well, you get an error, telling you that is not defined.
If you reopen a Notebook, you have to run all the cells containing code you need.
The obvious benefit is, you can add single lines of code and run them, without having the entire code be run again. So if you calculated 100000 prime-numbers in cell one, they are in memory if you run the next cell twenty times (yes, you can run the same cell several times - keep in mind it’s code will be added in the imaginary Python-document twenty times).
Wheres in plain Python, you can only run the entire document - so if you edit one line and rerun it, it would re-execute all code, including whatever produced the 100000 primes.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.