# Guided project [1]: Prison Break

Prison Break Project .ipynb (79.5 KB)

Hi,
This is my first guided project and I had a lot of fun.
I have no coding background, and have a couple questions doing this project.

1. In the step where you modify data so that the last element of each row (the Details) isn’t present anymore. I wanted to understand the code better, so I did:

index = 0
for row in data:
data[index] = row[:-1]

expecting the return would be just the first row without the last element and the other rows would remain the same, but instead I got a weird result, where the list began in 2020, then jump back to 1973.

1. In the step for min and max year, I have trouble understanding
min(data, key=lambda x: x[0])[0]

my understanding for min() is only limited to:
x = min(1,2,3)
print(x)
then it would return 1

having that said, I have trouble understanding why you could put data first then followed up by key=lambda x: x[0])[0], and I couldn’t understand what key=lambda x: x[0])[0] really is either.

I would very much appreciate if someone could answer these questions. Thank you for spending time on this post. Hope to see you all soon in the next project.

Click here to view the jupyter notebook file in a new tab

Welcome to DQ community. Glad you took the first step to learning data analysis using python without prior coding experience. It is a good first step, especially when you’re having fun with guided projects!

``````index = 0
for row in data:
data[index] = row[:-1]
``````

if you have tried this code, you can see that `index` is set to zero and inside the `for` loop it is not getting updated. So whatever iteration is happening to `row` , the other side remains `data[0]`.

Was that what you wanted to achieve?
Anyway if you want clarity while handling for loops and what it returns, it is a good practice to try and print each element of the loop to figure out what exactly is happening inside the loop.

For example you can try to print `row` or `row[:-1]`, `data[index]` etc and decide your next steps.