Ask your own question, for FREE!
Computer Science 20 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!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
1 day ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
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!