Last active
January 13, 2018 03:45
-
-
Save TutorialDoctor/e9128e3d164226043681a90164e60772 to your computer and use it in GitHub Desktop.
job_application_code
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
L = [[1,2,[3]],4] | |
#test_list = [1, 2, 3,[[4]],[[[5]]],[6],[[7]]] | |
model = 9 | |
empty = [] | |
def get_numbers(mod,L): | |
global empty | |
#For each item in the list | |
for item in L: | |
#If the type of the model is the same as the item: | |
if type(mod) == type(item): | |
#Append the item to an empty list. | |
[empty.append(item)] | |
#Otherwise, if the type of the model is not the same as the type of the item: | |
elif type(mod) != type(item): | |
#Run this function against the item. | |
get_numbers(mod,item) | |
print('box') | |
get_numbers(model,L) | |
print(empty) | |
# This algorithm was modeled using the diagram below. "n" is a number and the boxes model the list. | |
########################## | |
# ################# # | |
# # ###### # # | |
# # nn # n # # n # | |
# # ###### # # | |
# ################## # | |
########################## | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment