9. More with 'For'


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

for item in start_list:
start_list.append(item ** 20)

print start_list


It takes to long to run it says, (Check for infinite loops)

I want to Write a for-loop that iterates over start_list and .append()s each number squared (x ** 2) to square_list.
Then sort square_list!

Replace this line with your code.


the code you wrote is raising the number to the 20th power not squaring it make sure to change that! Also be very careful with your indentation. when you're printing squarelist at the end it should not be indented and should line up with your "for item in start_list" line. However, startlist.append and startlist.sort should be indented.


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