Can't Run code for helicopter prison escapes

I cant seem to get this code running.

url = ‘List of helicopter prison escapes - Wikipedia
data = data_from_url[url]

It returns;

NameError Traceback (most recent call last)
1 url = ‘List of helicopter prison escapes - Wikipedia
----> 2 data = data_from_url[url]

NameError: name ‘data_from_url’ is not defined

I don’t know what I’m Doing Wrong

1 Like

NameError suggests that data_from_url has not been defined. Check whether you’ve created that variable or run a cell containing that variable definition.

data_from_url if I remember correctly comes from the helper functions imported in the first notebook cell.

Make sure the following was run: from helper import *

And also, data_from_url is a function so it should be called by adding a pair of parenthesis () and not square brackets []. Like this: data_from_url(url)

Try working on those and see if they solve your problem. Feel free to ask questions if you’re still stuck.

This variable wasn’t created prior to this.
as it wasn’t on the instructions

[quote=“bintiaogheneovo, post:4, topic:564989, full:true”]
Hello @wanzulfikri ,

I am still unable to run this code.
I wish to start over but I do not know how to go about getting a clean sheet.

If you’re running the notebook from within Dataquest, you can click on ‘File’ and select ‘New notebook’ or something like that.

Or you can just delete all the cells in your notebook. Select the cell and click ‘D’ twice. Another way is to open the ‘Edit’ tab and click ‘Delete Cell’.

new notebook created a new file in a seperate tab


Yup, that’s how it currently works.

You can also just delete all the cells in your previous notebook.

I deleted it but if in run a code in say, cell 1/2
the next cell shows cell 19


The new sheet works fine thank you so much

Yep, that’s because the notebook still stores the results of your previous cells even if they were deleted.

You can restart the kernel to restore to initial state. Try opening the kernel tab, and click ‘Restart’.

Ah, nice!

No worries. Feel free to ask questions if you find yourself stuck after this.