Unknown Error


Hi, I try not to ask too much on Codecademy discuss, but I was editing my code and I got an unknown error:
UnknownError:4499487034400744422399883699070518459977417540107580784616832359547547245109505090527272972979722082995740522542872829656127723057561581320513974503373876961888748328699295727630511623520954224253428145606236015862418679033632227728004302007503375718918249856914531710839496313586763217751256912590039287070262248026920501928387281969933665083457853128251416873901851787868215565511081942479791787475` (there's more, more, more numbers). is that a glitch? I hope what I'm asking isn't bad. :sweat:
I know my code is wrong, and I get too many infinite loops, but yeah I just wanted to know. I refreshed the page many times and the lesson freezes on me (probably because of some sort of overload). What should I do?


This is probably happening because the code is using append to add to start_list while it's iterating through start_list. If start_list is having a number added to it every time it goes through the for loop, the numbers in start_list will never end.

Hopefully this helps you fix the problem.


I will check. thanks for fast reply.


Like this?

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

# Your code here!
for start_list in square_list:
    start_list.append(square_list ** 2)
    print square_list

And square_list should be the same length as start_list.

or should square_list.sort() be before print square_list??? I don't think so because that would be an unexpected indent. :confused:
Codecademy doesn't have the greatest instructions on how to do this, and I dont have a firm understanding on .append() so that makes things worse.


This line

for some_variable_name in start_list:

will go through every number in start_list one at a time and each time that number will be represented by some_variable_name. So, according to the instructions you need to square that number each time and append it to the square_list. Perhaps a good variable name for use in the for loop would be number and that might make things clearer:

for number in start_list:

append is a function that can be called on a list. It takes whatever argument is passed to it and adds that value to the list it was called on. So if I were to do

my_list = []

The contents of my_list would now be [1, 2].

Let me know if you give it another try and anything still doesn't make sense!


I will check and see how it works, thanks!


@liamseanbrady, I figured out to append things, but when I try to square it and throw it into square_list, it doesn't work.

start_list = [5, 3, 1, 2, 4] 
square_list = []
# Your code here!
for square_list in start_list:
       print start_list

start_list now contains:

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

and square_list contains:


I just switch what to print and that's what I got. How do I not modify start_list?

Do I do this:
square_list = start_list ** 2
or do I make a new variable? When I tried this, it didn't work and I read my notes and examples to double check, but nada-nope -- nothing. :frowning: I know I'm not supposed to make any statements so I didn't do that.


start_list must of gotten looped and now it contains the [] from square_list. And square_list isn't really 'sorted'. square_list contains the list numbers from start_list, but it's not squared. :confused:
-I replied to myself accidentally.-


Nevermind. I figured it out. I didn't know I was supposed to use list in my code. Thanks! :slight_smile:


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