Tired of using the solutions to get unstuck. nice knowing you all

i think this is the moment I realise this is not for me. have no idea what to write here and im tired of using the solutions to get unstuck. nice knowing you all

1 Like

Hi vinan89,

I’m so sorry I missed this earlier. I know it’s really tough to make that call when deciding whether to apply more work or to write something off entirely. I’ll respect your decision, but I’m going to write a little more for you or for someone who may follow who is also struggling but is willing to keep going for a little bit longer.

Honestly, I found this lesson really hard to wrap my head around when I first took it. I’m going to try stating things in a different way that might help.

Imagine you are telling someone how to drill out a wooden board for making a battleship game. You might say something like this:

“Start at the top of the board and drill out five holes, going from left to right. Then, go down a little on the board and drill out 5 more holes from left to right under that first row. Make third, fourth, and fifth rows the same way – each having 5 holes drilled from left to right under the row above it. As you do it, the rows and holes should line up neatly in a 5 by 5 grid.”

Now let’s start making that look a little bit like python code. I’ll make a python list to keep my instructions in (each separate instruction step is an item in the list):

Making the empty list:

my_instructions =

Now I’m going to describe what to do with the first row of the board:

my_instructions = [“Start at the top of the board and drill out five holes, going from left to right.”]

That’s now a list with a single item. Now I have a description for what to do on the first row, but I want to have 5 rows, not just one. I’ll add a second item to my list, and that will be the instructions for the 2nd row:

my_instructions = [“Start at the top of the board and drill out five holes, going from left to right.”, “Drill out 5 more holes from left to right under that first row.”]

Now I have instructions for two rows. Except my instructions don’t really need to say that the second row is under the first row. Why? Because we are going to use these instructions later, and when we do, we will make it a rule that each new item in the list is instructions for a single row, with the first item being the top row, second being the row below it, etc.

So, we can leave out the location details in both list items:

my_instructions = [“Drill out five holes, going from left to right.”, “Drill out 5 more holes from left to right”]

Well, our next part of the instruction is just to do the same thing three more times. In this case, though, we want to spell it out. So, we can just copy the second item on the list three more times:

my_instructions = [“Drill out five holes, going from left to right.”, “Drill out 5 more holes from left to right”, “Drill out 5 more holes from left to right”, “Drill out 5 more holes from left to right”, “Drill out 5 more holes from left to right”]

But wait – we have five ‘items’ to do (and each item is basically just ‘make one row’). In reality, we are doing 25 things, because we are drilling 25 holes. But if we make a list with 25 individual items, it doesn’t automatically group them by rows. We want to drill each hole separately, but also keep them grouped by row so we know when to start a new row.

It would help here to imagine a to do list that has items but also has sub-items:

To do list:

  • Drill out the first row from left to right
    - Drill Hole 1
    - Drill Hole 2
    - Drill Hole 3
    - Drill Hole 4
    - Drill Hole 5
  • Drill out the second row from left to right
    - Drill Hole 1
    - Drill Hole 2
    - Drill Hole 3
    - Drill Hole 4
    - Drill Hole 5
    Etc.

You would check each box as you drill each hole, but you would also find it easy to know when to switch to drilling the next row. In that case, the instructions would look more like this…

Make your overall empty list (each item in this list will be one of your five rows):

hole_by_hole_instructions =

Add the first row of holes:

hole_by_hole_instructions = [[“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”]]

So what went on there? Basically, I made a single list item that is all of row 1, and because row 1 has five holes to drill, I made a little sub-list that has five to do items in it. That hole_by_hole_instructions list is actually only one item long, because its one item is really just ‘do the first row.’ If we want more than one row, we’ll put a comma after our first list item (reminder, our first list item is [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”]) and then add another item that will be row 2:

hole_by_hole_instructions = [[“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”]]

Make 3 more items (rows), and you have all 25 holes drilled:

hole_by_hole_instructions = [[“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”]]

The reason this works is that we structured it in a way that lets us say “take the hole_by_hole_instructions. The first item is your list of things to do in the first row, from left to right. The next list item is things to do in the second row. Third list item is things to do in the third row, etc.”

This is a format for instructions that python can handle very easily, just like a human can easily understand a to do list with sub-items that have to be checked off.

In the case of the exercise, we don’t have a physical board to drill. It’s more like we are writing out ‘O’ a bunch of times on a piece of paper. Then, as we shoot at the board, we will take an eraser and scrub out an ‘O’ and write an ‘X’ instead to show we already tried that spot. Our ‘eraser’ and ‘write in an X’ will be telling python to go to a specific spot on the list, and change that value from ‘O’ to ‘X’.

It would be like telling our person with a drill to grab a new board and drill a bunch of new holes, but for the hole where we guessed, they need to drill out the hole and then stick a peg in it to show it was already guessed. Pretty labor intensive for our person with a drill!

If we guessed row one, hole 3, the second board’s instructions would have to look like this:

hole_by_hole_instructions = [[“drill hole 1”, “drill hole 2”, “drill hole 3 and stick a peg in it”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”], [“drill hole 1”, “drill hole 2”, “drill hole 3”, “drill hole 4”, “drill hole 5”]]

2 Likes

Thank you sir for your well thought out and considerate response. You really did not have to. I am still here and when I made that post it was in a moment of frustration.

Do not get me wrong I appreciated that very detailed reply although it has left me in a deeper state of confusion LOL. This is not any one’s fault, however it shows we are both at different stages of this journey of learning computer programming.

You are definitely at a more advanced stage which explains your programmer-esque method of explaining things.

I was mostly frustrated about the fact that I am not getting something that i WANT to learn. It’s not like my maths class back in school days where you do your work ask your friend for the answer and then wait for class to end. This is something i genuinely want to understand and my brain asks “WHY” a lot and it needs a lot of basic(to some) explanations.

The simple fact is I still show up here every single day because I enjoy learning this, even if it is for only 30 minutes a day. I have kept up with the habit for over 3 months now thanks to the lock down. Some days I feel good about learning a particular lesson straight away and most days its like why am I here, this is not for me, i will never succeed in this, or even be able to work in this field, so whats the point? Those are usually the “string” of thoughts that occur to me on days of utter confusion. Sometimes what i find frustrating is the way in which the codecademy presents its exercises. I don’t know if that is done deliberately to make you struggle to find a solution or not but it is frustrating. The best way I can explain it is like this:

New topic:

example
2 + 2 = ?
solve the equation
Answer: in order to find the answer we add the first integer with the second.

They will introduce a topic like so with a sample equation to show how some thing is done, then when its your turn to do it they give you something like…
x + 2 = 4
solve for x
and I am sitting here thinking what the ■■■■? You never explained how to do that.

I hope that extremely basic example made sense to anyone who reads this and understands what I mean. Of course i might look back a year from now at this post and wonder what was I crying about the real hard stuff comes later.
haha
sorry for the long message
but yes i was just having a moment…

thank you again for your help and advice.

2 Likes

I found this string of communication very enlightening. Thank you both for your correspondence, it was delighful and extremely helpful. @vinan89 and @beta0349246094 :smiling_face_with_three_hearts:

1 Like

Hi vinan89,

I would say that programming gets both harder and easier. First you have to wrap your head around the basic types of methods used to get something done, and that’s the part that gets super easier once you have more experience under your belt.

The part that gets harder is when you will be looking at a problem and you have to break it into pieces, with each piece needing a certain type of solution (like deciding whether a list of fruit prices should be a list or a dictionary). If you don’t get a foundation in what each building block is good for and how it works, you won’t know how to break the problem into small enough pieces, and the problem will merely look impossible.

“Well, first I need a way to give each piece of fruit a price. That sounds like a dictionary, not a list. That way, I can have all the fruits and all the prices in one place where I know they will stay properly connected to each other. Then I’ll fill the dictionary with values like an apple costing $1.50. If I went with two lists – a fruit list and a price list – things might get out of order when I make a change to just one of the lists. And then an apple might be listed as $3.50 instead of $1.50, all because I made a change to one list but didn’t change the other. If I make a dictionary, the price and the type of fruit will automatically stay together when I make changes or add things to the dictionary.”

Some of the lessons in Codecademy teach you how to use the different types of building blocks – they show you how to do something then ask you to do it using different values. Sometimes you get lessons that use things you covered in earlier lessons, and you have to go back and see how you did it before. Sometimes they are deliberately setting a puzzle where you have to break down a task and figure out what methods might get the individual steps done. Those come up a fair amount the further along you are in the course, I would say.

While I was doing the Python 2 course, I tried to do what they said, but I didn’t beat myself up if I couldn’t figure it out. I definitely used the solutions button when I got stuck and had no more useful ideas to try. When I did that, I saved my own code first in a text document and then compared it to the solution to see what was different. Sometimes I missed something critical, other times I just misspelled something or missed a detail in the instructions (it’s really easy to do).

I think at this stage, you might find it valuable to look more closely at what is tripping you up regularly. If you push the solutions button and you often can’t say you understand their solution (after studying it and running it a few times and comparing it to your own code that you saved in another window), then it’s possible you have pushed through too quickly in earlier parts of the course and are still missing foundational concepts.

I hate to say it, but it may be worth resetting the course and starting over – and honestly, you even might find yourself having fun again. Even though it’s painful to think of losing progress, I think you will be surprised how the early lessons aren’t as bad as they were the first time around. If you go that route, take the time to understand each lesson’s solution. I’m sure you would run into things that you gave up on before but now can figure out (or would find you understand the solution, even if you can’t get to it yourself on your own). If you remember how to solve something from the first time, all the better – that means you are absorbing the material and getting extra practice!

If you keep pushing forward just to progress through the course, the increasing rate of puzzle pages is going to be a serious bummer.

Of course, there’s nothing wrong with trekking on, either. :smile: When you really hit the point where going back sounds better than trying to go forward, you’ll still have picked up additional learning that would make a fresh run go faster. Or you might find things clicking and keep going until the end.

The most practical piece of advice I can give you is that Codecademy doesn’t always tell you to print things, but printing things is seriously the best. You can toss in a print statement in so many places. It doesn’t really get in the way of what you need to do, and it can show you what values you are getting. Codecademy won’t reject your solution for adding in extra print statements, so there’s no reason not to. Often you don’t know what is wrong until you can see what the code thinks you are asking for.

Let’s say you were trying to code a list of fruits and their prices and you decided to use two lists instead of a dictionary. Then your “result” prints with an apple costing $3.50 when it should be $1.50. One of things you could do to understand what went wrong is tell python to print your lists after giving you the bad result. Then you can see that something got added to one of the lists earlier in the code and now the list is out of order. Maybe the only way you would spot the problem is asking to see the list again – not the way it was when you first made it, but how it is now after the code has made some invisible changes to it.

Printing a bunch is how you make the invisible become visible again.

Good luck!

2 Likes

You could look into diversifying your methods of study. I find that I learn much more from books and high quality youtube videos than the modules here. But that’s just me. I like to use them to sometimes play around with the beginning concepts of a language I don’t know yet.

There are also some modules here that are really good and gave me good practice in things I otherwise wouldn’t have thought of.

3 Likes