Example
Sorting and Reversing Lists
Methods sort() and reverse() for ordering list elements.
8 results
Example
Methods sort() and reverse() for ordering list elements.
Challenge
From today's passes over four ground stations, collect every contact window longer than 8 minutes into one list, sorted by time, then find the longest stretch with no station in contact, counting…
Quiz
…on indexing, slicing, append, insert, pop, remove, sorting and copying, with instant answers.
Challenge
…it, find out what sort() really gives back, fix it by sorting in place, then sort readings from highest to lowest and keep the top three.
Challenge
Sort launches by date with sorted() and a small function that returns each launch's date, then sort the cargo manifest heaviest first with a key function and reverse=True.
Quiz
…What can go in a set, frozenset , set comprehensions and sorting the items of a set How it works 15 questions: 11 with one correct answer, 4 where you select every correct answer After each question…
Quiz
…and how to build a new one instead count() , index() , sorting, nested tuples and divmod() How it works 15 questions: 11 with one correct answer, 4 where you select every correct answer After each…
Article Python Fundamentals
…when you need a quick throwaway function, for example when sorting a list. Anything a lambda can do, a normal def can do too, and the def version is usually easier to read. Leave lambdas for later…