Can you do .sort with numbers within strings? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you do .sort with numbers within strings?

Example: array=['6','72','24'] array.sort() So is array now ['6','24','72']? If so.... How can I do the same with: ['Name1:6','Othername:72','Andanother:24'] All help appreciated.

2nd Dec 2017, 4:59 PM
Max S
5 Answers
+ 3
I think that you can put the second array in a dictionary and then try
2nd Dec 2017, 5:34 PM
Ran Avital
Ran Avital - avatar
+ 3
Good luck and tell us if you succeed!
2nd Dec 2017, 6:20 PM
Ran Avital
Ran Avital - avatar
+ 1
Ok I will.
2nd Dec 2017, 5:59 PM
Max S
0
One more question for everyone: How do you sort the values in a dictionary?
2nd Dec 2017, 7:06 PM
Max S