Skip to content

Instantly share code, notes, and snippets.

@TutorialDoctor
Last active January 13, 2018 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TutorialDoctor/e9128e3d164226043681a90164e60772 to your computer and use it in GitHub Desktop.
Save TutorialDoctor/e9128e3d164226043681a90164e60772 to your computer and use it in GitHub Desktop.
job_application_code
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