Last active
January 1, 2021 23:02
-
-
Save slapec/df9b15dd63e6bc7eb80064b8730a4708 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
items = ('burger', 'fries', 'chicken', 'pizza', 'sandwich', 'onionrings', 'milkshake', 'coke') | |
def get_order(s): | |
words = re.findall('|'.join(items), s, flags=re.IGNORECASE) | |
words.sort(key=items.index) | |
return ' '.join(map(str.capitalize, words)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment