ĀæPor quĆ© si creo una variable que contenga el reverso de una lista, e imprimo esa variable el resultado es none? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

ĀæPor quĆ© si creo una variable que contenga el reverso de una lista, e imprimo esa variable el resultado es none?

lista = ["maƱana", "cƔlida"] reverso = lista.reverse() print (reverso) >>> none.

22nd Oct 2017, 8:23 PM
Kinestetic
Kinestetic - avatar
5 Respostas
0
Hablo un poco de espanol... Prueba esto: lista = ["maƱana", "cƔlida"] for word in reversed(lista): print (word) Good luck! :)
23rd Oct 2017, 4:27 AM
derXred
derXred - avatar
0
thanks for your answer, but what interests me is to understand the logic. Why the variable does not contain the reverse?
23rd Oct 2017, 8:00 AM
Kinestetic
Kinestetic - avatar
0
what you want to achieve? reverse of the list or reverse of the letters of each word? (reversed is a function/action that change the variables order inside de list from 1 to n => n to 1 i am not sure what you call "variable" :p if you can explain a bit,maybe i can help you a bit
23rd Oct 2017, 12:55 PM
derXred
derXred - avatar
0
variable is the container name. for example, in this case the variable would be lista. y pues, lo que tenia pensado era que mostrara la lista de la siguiente manera ["cƔlida","maƱana"]
23rd Oct 2017, 5:32 PM
Kinestetic
Kinestetic - avatar
0
well with what i gived you earyler that you gonna achieve :) word1 will be at the end and word2 gonna be first
23rd Oct 2017, 5:37 PM
derXred
derXred - avatar