How to sort by ~~ 로 in Python?

Asked 2 years ago, Updated 2 years ago, 12 views

I'm trying to sort with Python, how do I do it? (Sort by string array) (Example: list[0]President, list[1]Accusation => list[0]Accusation, list[1]President Kim)

python

2022-09-20 17:47

2 Answers

a = ["President Jang", "President Wang", "President Choi", "President Kim"]
b = sorted(a)
print(b)
>> ["President Kim", "President Wang", "Chairman", "President Choi"]


2022-09-20 17:47

Korean = ["M", "N", "H", "C", "G"]
korean = sorted(korean)
print(korean)


2022-09-20 17:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.