2 Works in Python 2 or 3
source | link

Python 2, 32 bytes

lambda s:s.sort(key="npr".strip)

Try it online! Sorts the list in place.

The idea is to use a sorting key function without a lambda. A good candidate was x.strip, which takes the string x and removes its the left and right edges all characters in the input. For example, "abcdef".strip("faces") == "bcd".

The method "npr".strip takes:

quarter ->  np
dime    ->  npr
nickel  ->  pr
penny   ->  r

which are lexicographically sorted. I found the string npr by brute force. npu and npt also work, and there are none shorter.

Python 2, 32 bytes

lambda s:s.sort(key="npr".strip)

Try it online! Sorts the list in place.

The idea is to use a sorting key function without a lambda. A good candidate was x.strip, which takes the string x and removes its the left and right edges all characters in the input. For example, "abcdef".strip("faces") == "bcd".

The method "npr".strip takes:

quarter ->  np
dime    ->  npr
nickel  ->  pr
penny   ->  r

which are lexicographically sorted. I found the string npr by brute force. npu and npt also work, and there are none shorter.

Python, 32 bytes

lambda s:s.sort(key="npr".strip)

Try it online! Sorts the list in place.

The idea is to use a sorting key function without a lambda. A good candidate was x.strip, which takes the string x and removes its the left and right edges all characters in the input. For example, "abcdef".strip("faces") == "bcd".

The method "npr".strip takes:

quarter ->  np
dime    ->  npr
nickel  ->  pr
penny   ->  r

which are lexicographically sorted. I found the string npr by brute force. npu and npt also work, and there are none shorter.

1
source | link

Python 2, 32 bytes

lambda s:s.sort(key="npr".strip)

Try it online! Sorts the list in place.

The idea is to use a sorting key function without a lambda. A good candidate was x.strip, which takes the string x and removes its the left and right edges all characters in the input. For example, "abcdef".strip("faces") == "bcd".

The method "npr".strip takes:

quarter ->  np
dime    ->  npr
nickel  ->  pr
penny   ->  r

which are lexicographically sorted. I found the string npr by brute force. npu and npt also work, and there are none shorter.