Python Forum
excercise python list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
excercise python list
#8
Please can you try to make full sentence. English is not my mother language and currently I don't understand your question.

Do you want to have the order of appending? Then do nothing, task is finished. The order stays in a list.

If you need to sort the items in the list by name (A-Za-z), just use the in-place sort of list.
list1 = ['s', 'z', 'd', 'a']
list1.sort()
print(list1)
If you need the original list and a sorted list:
list1 = ['s', 'z', 'd', 'a']
list2 = sorted(list1)
print(list2)
If you need a custom order, you have to write your own key-function for sorted.
You can read here more: https://wiki.python.org/moin/HowTo/Sorting
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
excercise python list - by Kykoss - Feb-10-2018, 08:08 PM
RE: excercise python list - by j.crater - Feb-10-2018, 08:38 PM
RE: excercise python list - by Kykoss - Feb-10-2018, 08:53 PM
RE: excercise python list - by nilamo - Feb-10-2018, 09:58 PM
RE: excercise python list - by Kykoss - Feb-10-2018, 10:15 PM
RE: excercise python list - by nilamo - Feb-10-2018, 10:34 PM
RE: excercise python list - by Kykoss - Feb-11-2018, 09:06 AM
RE: excercise python list - by DeaD_EyE - Feb-11-2018, 03:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with the excercise alani 3 2,156 Apr-19-2020, 07:29 PM
Last Post: deanhystad
  Program excercise SushiRolz 1 2,493 Feb-28-2018, 01:48 AM
Last Post: Larz60+
  Homework-excercise gmit01 2 2,731 Dec-11-2017, 08:39 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020