Complete the following code so that it iterates through the two lists of numbers parallel, and adds up their same-index
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Complete the following code so that it iterates through the two lists of numbers parallel, and adds up their same-index
Complete the following code so that it iterates through the two lists of numbers parallel, and adds up their same-index values one-by-one. In case the sum (variable summa) is more than 25, break out of the loop. Submit the .py file in manaba R+. Name the file the following way: ip.ex44.<student id number>py. number_list_1 = [1,2,3,4,5,6,7,8,9,10,11] number_list_2 - (10,11,12,13,14,15,16,17,18,19,20] print("Length of the first list:", len()) #check the length of the first list print("Length of the second list:", len()) #check the length of the second list for number 1, number_2 in zip(): #iterate through the two lists! summa = #complete to add up the same-index values print("The sum is", summa) #print the sum if summa #complete to check if summa is more than 25, and in that case, break out of the Loop
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!