Last active
August 18, 2020 16:24
-
-
Save Allianzcortex/621b871b0414a30665cb6355837de2b7 to your computer and use it in GitHub Desktop.
Code Test for Urthecast
This file contains hidden or 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
def fib(N): | |
if N == 0: | |
return 0 | |
if N == 1: | |
return 1 | |
return fib(N - 1) + fib(N - 2) | |
if __name__ == '__main__': | |
print(fib(10)) |
This file contains hidden or 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
def calculate(original_list, add_list, delete_list): | |
s = list(set([x for x in original_list + add_list if x | |
not in delete_list])) | |
s.sort(key=lambda x: (-len(x), x)) | |
return s | |
if __name__ == '__main__': | |
Original_List = ['one', 'two', 'three'] | |
Add_List = ['one', 'two', 'five', 'six'] | |
Delete_List = ['two', 'five'] | |
print(calculate(Original_List, Add_List, Delete_List)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment