Skip to content

Instantly share code, notes, and snippets.

@jtallieu
Last active September 9, 2016 20:11
Show Gist options
  • Save jtallieu/8baa2c96289cc4542802dcef007f1e9b to your computer and use it in GitHub Desktop.
Save jtallieu/8baa2c96289cc4542802dcef007f1e9b to your computer and use it in GitHub Desktop.
Eagle Eye Networks Inc :: Python screening - Debug I
"""
::Eagle Eye Networks Inc.:::
::Python screening::
The following script is purposley written poorly.
Fix the 'magic' function.
"""
def magic(X, additional=[]):
"""
Combine the letters of the word X, with the
optional additonal letters and print them
in alphabetical order
"""
chars = list(X)
# Combine the characters and the
# additional letters if there are some provided
additional += chars
# Sort
additional.sort()
# print
print "".join(additional)
if __name__ == "__main__":
magic('eagle', list('eye networks'))
magic('eagle')
magic('eagle')
magic('video')
magic('eagle', list('video'))
@jtallieu
Copy link
Author

jtallieu commented Sep 9, 2016

$ python sample_5.py 
 aeeeeegklnorstwy
aeegl
aaeeeeggll    
aadeeeeeggillov   
adeeegilov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment