We begin by importing some helper functions.

In [9]:

```
from helper import *
```

In [10]:

```
url = 'https://en.wikipedia.org/wiki/List_of_helicopter_prison_escapes'
```

Now, let's get the data from the [List of helicopter prison escapes] (https://en.wikipedia.org/wiki/List_of_helicopter_prison_escapes) Wikipedia article.

In [16]:

```
data = data_from_url(url)
```

Let's print the first three rows

In [17]:

```
for row in data[:3]:
print(row)
```

In [18]:

```
index = 0
for row in data:
data[index]=row[0:-1]
index +=1
print(data[:3])
```

In [19]:

```
for row in data:
row[0] = fetch_year(row[0])
print(data[:3])
```

In [43]:

```
print(len(data))
```

In [20]:

```
min_year = min(data, key=lambda x: x[0])[0]
max_year = max(data, key=lambda x: x[0])[0]
```

In [21]:

```
years = []
for y in range(min_year, max_year+1):
years.append(y)
```

In [22]:

```
attempst_per_year = []
```

In [40]:

```
l = [[1,2],[3,4],[5,6]]
dl = [l[i][0] for i in range(0,len(l))]
print(dl)
```

In [41]:

```
ind =l.index([1,2])
l[ind] = [2,3]
```

In [42]:

```
print(l)
```

In [45]:

```
def year_locator(year, l):
dl = [l[i][0] for i in range(0,len(l))]
if year in dl:
return dl.index(year)
```

In [50]:

```
def count_years(data, years):
l = []
for i in years:
l.append([i,0])
for k in years:
year_data = k
count_year = 0
for j in data:
if year_data == j[0]:
count_year += 1
ind = year_locator(year_data,l)
l[ind][1] = count_year
return l
```

In [51]:

```
attempts_per_year=count_years(data,years)
```

In [52]:

```
print(attempts_per_year)
```

In [53]:

```
attempts_per_year2 = []
for i in years:
attempts_per_year2.append([i,0])
```

In [54]:

```
for row in data:
for ya in attempts_per_year2:
y = ya[0]
if row[0] == y:
ya[1] +=1
```

In [55]:

```
print(attempts_per_year2)
```

In [56]:

```
%matplotlib inline
barplot(attempts_per_year)
```

In which year did the most attempts at breaking out of prison with a helicopter occur? The years 2001, 2007 and 2009

In [57]:

```
countries_frequency = df["Country"].value_counts()
```

In [58]:

```
print_pretty_table(countries_frequency)
```

In [ ]:

```
```