python method to zipper together lists

I had help from one of my classmates in LPTHW for this one, but we got it working.


monsters = ["yeti", "abominable snow man", "ROUS", "Tribble", "Spot", "Ewok", "Wookie", "Golem"]
places = ["antarctica", "South Pole", "Fire Swamp", "Enterprise", "Generations Enterprise", "Forest moon of Endor", "Just Awesome", "Mt.Doom"]

def zipper_lists(arg, arg2):
b = 0
size = 0
new_list = []
if len(arg) == len(arg2):
size = len(arg)
print("if executing")

while len(new_list) < len(arg) + len(arg2):
print("While executing")
print(f"b : {b}")
if b <= size:
additem = arg2[b]
new_list.append(additem)
additem = arg[b]
new_list.append(additem)
b+=1
print(f" b: {b}")
else:
print(f"arg : {arg} is not the same size as {arg2}")
return new_list
#print(new_list)
#zipper_lists(monsters, places)
zippered = zipper_lists(monsters, places)
print(zippered)



Comments

Popular posts from this blog

JavaScript Ascii animation with while loops and console.log

playing with trigonometry sin in pygame

playing with color in powershell python