I struggled with reading comprehension tonight 🤦🏼♀️
defcalculate(num1,num2,nums):nums[1]=num1nums[2]=num2idx=0whilenums[idx]!=99:num=nums[idx]val1=nums[nums[idx+1]]val2=nums[nums[idx+2]]idx3=nums[idx+3]ifnum==1:nums[idx3]=val1+val2elifnum==2:nums[idx3]=val1*val2idx+=4returnnums[0]withopen("input.txt")as_file:forlinein_file:input_values=[int(num)fornuminline.split(",")]# part 1
print(calculate(12,2,input_values[:]))# part 2
GOAL=19690720foriinrange(100):forjinrange(100):ifcalculate(i,j,input_values[:])==GOAL:print(100*i+j)break
I struggled with reading comprehension tonight 🤦🏼♀️
Thank you! It really helps me to understand the second part.
Yeah, the second part's wording was really confusing to me.
Me too! I spent a good couple minutes trying to figure out why the sum of their test opcode didn't match the answer... 😭