3 Make a List


#1

Totally messed up and don't know what to do.
Need some help, not complete, but right way.


"Can anyone help?" Captain Obvious?


#2

Can I see your code and error message? What exercise is this?


#3

This should be the exercise.

https://www.codecademy.com/en/courses/python-beginner-en-4XuFm/0/3?curriculum_id=4f89dab3d788890003000096


#4

Instruction not clear enough, not quite see how to deal with it ;[
And don't want for complete answer.


#5

Thanks :slight_smile:


#6

You need to do a for loop. In the for loop, copy the example they've given you about the ["O"] * 5 to create 1 row. Then you need to append those to board for them to appear. The loop function will do a few more rows until you've reached the # of rows you desired (which is 5 in this problem).


#7

Let's take this step by step. Instructions tell us:
Create a 5 x 5 grid initialized to all 'O's and store it in board.Use range() to loop 5 times.
Inside the loop, .append() a list containing 5 "O"s to board, just like in the example above.
Note that these are capital letter "O" and not zeros.

board = [] #Make an empty list board

for i in range(5): #looped with range for 5 times

Since you don't want the full answer I will let you complete the rest of the code. Now you have to .append() a list containing 5 "O"s to board inside the for loop, then print board. If you are still confused message me.


#8

board = []
for i in range(5):
    board.append(["O"] * 5)
print board

got all in one line, not each on separate line. Is this correct?
Got green light. "way to go" thought need to do them like 5*5 on separate lines.


#9

Yeah, step #5 will tell you how to get them on separate lines


#10

Thank you.
Keep going.


#11

Yup, that's correct. Great job! :slight_smile:


#12

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.