Python Forum
Write a function sorting(L)?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write a function sorting(L)?
#1
my question here
Write a function sorting(L) that takes a list of numbers and returns the list with all
elements sorted in ascending order.
Note: do not use the sort built in function
my code here
Reply
#2
what have you tried?
to sort list, it's
listname.sort()
Reply
#3
i think i could not use this
Reply
#4
(Apr-21-2017, 07:52 PM)MoIbrahim Wrote: i think i could not use this

I would assume so.  Anyway, you need to show us an attempt.

My assumption is that your instructor probably expects you to implement bubble or insertion sort:  
https://en.wikipedia.org/wiki/Sorting_algorithm
Reply
#5
(Apr-21-2017, 07:48 PM)Larz60+ Wrote: what have you tried? to sort list, it's
listname.sort()
i think i can't use this
Reply
#6
(Apr-21-2017, 07:54 PM)Mekire Wrote: I would assume so.  Anyway, you need to show us an attempt.
Reply
#7
def sorting(items):
    return sorted(items)
ezpz
Reply
#8
(Apr-21-2017, 08:05 PM)nilamo Wrote:
def sorting(items): return sorted(items) 
ezpz
thank you but i can't use that
Reply
#9
Your thread is going to end up locked in a second. You have been told you need to make an honest attempt. I gave you a link to sorting algorithms. I told you which ones to look at. Make an attempt and THEN reply.
Reply
#10
What have you tried so far? We can keep making jokes all day, but we're not going to write it for you.
If you just want an answer, go to wikipedia and copy-paste their quicksort example.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question How to Write a function with Pandas? SuperNinja3I3 4 2,348 Jul-03-2022, 02:19 PM
Last Post: ndc85430
  How can I write a function with three parameters? MehmetAliKarabulut 3 2,783 Mar-04-2021, 05:23 PM
Last Post: buran
  Write function to find decryptionkey kotter 3 3,128 Dec-11-2019, 07:04 PM
Last Post: nilamo
  I Can't Get This Sorting Function In This LinkedList Code To Work JayJayOi 10 7,925 Jan-11-2018, 01:14 AM
Last Post: JayJayOi
  how to write a function in python that solves an equation samiraheen 5 9,770 Sep-28-2017, 01:10 AM
Last Post: Mekire
  function to write the contents of a webpage into a new file roadrage 4 6,033 Dec-01-2016, 09:28 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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