Strugging With Array Scenario

Could anyone possibly provide a code example please? Not sure how to target indexes and on top of that how to add an index to an element, and vice versa.
Thanks in advance!

This is basic coding stuff. Have you done some basic tutorials? What have you tried so far? This is a learning platform so we try to avoid blurting out answers. Can you be more specific about what is confusing you?

I needed help with this specific question, even though I’ve gone through basic tutorials, it’s very vague and doesn’t suffice. The images are questions marked as “review” it’s not live. I basically just wanted to get an example what the code should look like for this question. That way I can compare and see where I went wrong.

I’m very confused. Besides being a fairly straightforward question, there seems to be an answer at the end.

But I guess I have to ask what your Python level is. Do you know how to do the first step? Do you know how to “Create an empty array then input five number into the array”?

I know how to create an array, but not sure how to put multiple numbers in one array, and also do not know how to target these indexes. The first two images are the scenario, and then the inputs, the last one is my code, which is faulty.

OK. There’s nothing wrong with being a beginner, but if you need help in even creating the array (the most basic step) then the next steps are going to need our help to. Basically you are asking for us to step you through this and do each step for you.

I would recommend spending some time learning the fundamentals here. There are a lot of materials online to help with this, there is no need retype it. I would look on youtube for videos on Python arrays (lists). I would also point out that FCC has a course on Python. Once you do that, it’s just a matter of a little conditional logic (if/else) and some mathematical operations.

Knowing how to research things is a VERY important skill for a developer. If you’ve tried something and it isn’t working the way you think it should, please come back and ask.

2 Likes