9. More with 'For'


#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/python-lists-and-dictionaries/exercises/more-with-for?action=lesson_resume

I’m not understanding what’s wrong with it. I know that it creates a everlasting loop but what do I put to make it not loop forever?

start_list = [5, 3, 1, 2, 4]
square_list = []


for number in start_list:
  square_list.append(number ** 2)
square_list.sort()
   
print square_list



#2

the code you posted does not produce an everlasting (infinity) loop, after iterating over all numbers in start_list, the loop exit


#3

wow I look like booboo the fool, I swear it wasn’t letting me pass the section and it was taking forever to like… tell me if i got the code right or wrong which is usually an indicator that the code loops… thanks anyway smh


#4

The code you posted here on the forum worked fine, that is all i can tell you :slight_smile:


#5

A post was split to a new topic: Square_list


#6

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