-2

I'm new to programming and now taking the course MIT 6.0001. On problem set 2, they set a .py file, accompanied with a .txt file.

I ran .py file in Spyder with no difficulties (.txt file embedded just fine).

But when I run .py file in Jupyter, things won't run (as in screenshot).

I want to use Jupyter because it's much clearer than Spyder, and can give headers to cells to keep myself on track. Please help me to run things in Jupyter.

Here are link to the problem set (ZIP file)

File not running in Jupyter

enter image description here

A.A Noman
  • 5,244
  • 9
  • 24
  • 46
trang nguyen
  • 65
  • 1
  • 5
  • Possible duplicate of [How to load/edit/run/save text files (.py) into an IPython notebook cell?](https://stackoverflow.com/questions/21034373/how-to-load-edit-run-save-text-files-py-into-an-ipython-notebook-cell) – Georgy Feb 13 '18 at 17:30

1 Answers1

1

Use

%load filename.py

to import the text of your python file into a cell in a Jupyter notebook and then save that notebook.

Jupyter isn't built to run/edit .py files, it's built to run/edit jupyter notebooks (ipython notebooks) (.ipynb)

John R
  • 1,505
  • 10
  • 18