JortSort: Difference between revisions
Content added Content deleted
(→{{header|Python}}: Removed Javascript translation as it's using bad Python practices) |
m (→{{header|Python}}: Using f-strings; PEP 8 naming) |
||
Line 663: | Line 663: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
<lang python>>>> def |
<lang python>>>> def jortsort(sequence): |
||
return list( |
return list(sequence) == sorted(sequence) |
||
>>> for data in [(1,2,4,3), (14,6,8), ['a', 'c'], ['s', 'u', 'x'], 'CVGH', 'PQRST']: |
>>> for data in [(1,2,4,3), (14,6,8), ['a', 'c'], ['s', 'u', 'x'], 'CVGH', 'PQRST']: |
||
print(' |
print(f'jortsort({repr(data)}) is {jortsort(data)}') |
||
jortsort((1, 2, 4, 3)) is False |
|||
jortsort((14, 6, 8)) is False |
|||
jortsort(['a', 'c']) is True |
|||
jortsort(['s', 'u', 'x']) is True |
|||
jortsort('CVGH') is False |
|||
jortsort('PQRST') is True |
|||
>>> </lang> |
>>> </lang> |
||