Ask your own question, for FREE!
Computer Science 11 Online
OpenStudy (anonymous):

Is there a more elegant implementation of this? x = subjects.pop(subjects.index(text)) subjects.insert(0,x) When I put it directly into the second line, I get a wrong item popped. In case its not clear, I need to grab an element of a list and move it to the front.

OpenStudy (farmdawgnation):

What language is this?

OpenStudy (anonymous):

python

OpenStudy (farmdawgnation):

Sorry, Python is one of the few modern languages I'm not familiar with. :(

OpenStudy (anonymous):

The right code is: x = subjects.pop(subjects.index('text')) subjects.insert(0,x)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!