id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

bryce.hulett@hotmail.com > is_sorted
prev  |  next  |  chance

Write a function named is_sorted that accepts a list of real numbers as a parameter and returns True if the list is in sorted (nondecreasing) order and False otherwise. For example, if lists named list1 and list2 store [16.1, 12.3, 22.2, 14.4] and [1.5, 4.3, 7.0, 19.5, 25.1, 46.2] respectively, the calls is_sorted(list1) and is_sorted(list2) should return False and True respectively. Assume the list has at least one element. A one-element list is considered to be sorted.


is_sorted([16.1, 12.3, 22.2, 14.4]) → False
is_sorted([1.5, 4.3, 7.0, 19.5, 25.1, 46.2]) → True
is_sorted([42.0]) → True

...Save, Compile, Run (ctrl-enter)

def is_sorted(lst):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 290 Post-solution available

Copyright Nick Parlante 2017 - privacy