Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Build the list of the squares of to : .
Start with [] and use append inside the loop.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. Start with an empty list. In a loop over range(1, 7), append n * n.
Check. The values of n are 1 to 6, so the squares are .
Log in to join the discussion.
Loading…