Yo no veo el orden | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Yo no veo el orden

dice que la lista estƔ ordenada, pero no cual es el parƔmetro, es decir, si es alfabeto u otro orden

19th Aug 2018, 4:18 PM
Javier Amores Ruiz
Javier Amores Ruiz - avatar
5 Respostas
+ 1
Los enteros y las cadenas se organizarĆ”n en una nueva lista con el mĆ©todo ordenado (). AdemĆ”s, ordenado (reverse = True) organizarĆ” la nueva lista al revĆ©s. TambiĆ©n hay una funciĆ³n .sort (), pero esto muta la lista actual y no crea un nuevo objeto. La gran pregunta es, ĀæcuĆ”l es mĆ”s eficiente? ... AquĆ­ es donde "timeit ()" ayudarĆ” a determinar la eficiencia. ''' alpha = ['a', 'z', 'b', 'v', 'c', 'd', 'm'] num = [9,4,2,0,6,5,1] imprimir (ordenado (alfa)) imprimir (ordenado (num)) '''
19th Aug 2018, 4:37 PM
Steven M
Steven M - avatar
+ 1
Gracias
19th Aug 2018, 4:38 PM
Javier Amores Ruiz
Javier Amores Ruiz - avatar
0
Integers and strings will be arranged in a new list with the sorted() method. Also, sorted(reverse=True) will arrange the new list backwards. There is also a .sort() function, but this mutates the current list and does not create a new object. The big question is which is more efficient?... This is where "timeit()" will help determine efficiency. ''' alpha=['a', 'z', 'b', 'v', 'c', 'd', 'm'] num=[9,4,2,0,6,5,1] print(sorted(alpha)) print(sorted(num)) '''
19th Aug 2018, 4:27 PM
Steven M
Steven M - avatar
0
disculpa pero si no me lo traduce no entiendo la respuesta. Gracias
19th Aug 2018, 4:30 PM
Javier Amores Ruiz
Javier Amores Ruiz - avatar
0
lo siento, mi espanol es malo y esto es google translate
19th Aug 2018, 4:41 PM
Steven M
Steven M - avatar