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 jortSort(myarray):
<lang python>>>> def jortsort(sequence):
return list(myarray) == sorted(myarray)
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('jortSort(%r) is %s' % (data, jortSort(data)))
print(f'jortsort({repr(data)}) is {jortsort(data)}')
jortSort((1, 2, 4, 3)) is False
jortsort((1, 2, 4, 3)) is False
jortSort((14, 6, 8)) is False
jortsort((14, 6, 8)) is False
jortSort(['a', 'c']) is True
jortsort(['a', 'c']) is True
jortSort(['s', 'u', 'x']) is True
jortsort(['s', 'u', 'x']) is True
jortSort('CVGH') is False
jortsort('CVGH') is False
jortSort('PQRST') is True
jortsort('PQRST') is True
>>> </lang>
>>> </lang>