21st Sep 2020, 3:34 AM
Smiley[Offline]
1 Antwort
+ 2
So "".join(sorted(list(s)[:4])) Start solving from the inside list(s) will convert think to list ['t', 'h', 'i', 'n', 'k'] then you have [:4] which is from zero to the fourth element which is t, h, i, n now apply sorted(['t', 'h', 'i', 'n']) which will return sorted list of this list which is ['h', 'i', 'n', 't'] now lastly .join() is a function that takes a list and join it with a string to convert the list to string so your result is hint if you have 'A'.join( ['h', 'i', 'n', 't']) This will give you hAiAnAt but since you are joining with empty string it become just hint
21st Sep 2020, 4:00 AM
Ruba Kh
Ruba Kh - avatar