vendredi 29 mai 2015

How to change numbers around in a list (python)

i have been working on this for 3 hours now but i have no clue how to do it

can anyone help me with this?

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

temp = values[0]

for index in range (len(values) -1):
    values[index] = values [index]

values[len(values)-1] = temp
print values

i want the printed values to be in order as [2,3,4,5,1] by simply changing those in the brackets

Aucun commentaire:

Enregistrer un commentaire