#A treasure box has a 4-digit combination lock. The box opens when you enter the #following value: (sum of middle digits)*(average of first and last digit). Write a #program that reads one 4-digit number, combination lock, and finds the number that #opens the box. #Example: 1234 #(2+3)*((1+4)/2))=5*2.5=12.5 #Part 1 Input: num=int(input("enter integer between 1000 and 9999: ")) #Part 2 Calculation: #Let's call digits d1, d2, d3, d4 where d1 is first digit and d4 is last digit save_num = num #saving an original value #Example num=1234 d4 = num%10 #d4=1234%10=4 num = num//10 #num=1234//10=123 d3 = num%10 #d3=123%10=3 num = num//10 #num=123//10=12 d2= num%10 #d2=12%10=2 num = num//10 #num=12/10=1 d1= num%10 #d1=1%10=1 open_box_combo=(d3+d2)*((d1+d4)/2) #Output print("the number that opens the box is", open_box_combo)