Which Python built-in function will you use to sort a list of numbers in ascending order?
- arrange()
- order()
- sort()
- sorted()
To sort a list of numbers in ascending order, you should use the sorted() function. The sort() method is used for in-place sorting, whereas sorted() returns a new sorted list, leaving the original list unchanged.
Loading...
Related Quiz
- The ____ keyword is used to create a new variable and assign it a specific data type.
- What is the time complexity of a linear search algorithm in the worst case?
- How can you configure a Flask application to use an external configuration file?
- Which algorithm would you use to find the shortest path in an unweighted graph?
- How can you optimize the performance of static files (CSS, JS, Images) in a web application developed using Python frameworks?