Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In PYTHON Write a function add list (lstl, lst2) that takes two lists of numbers of the same length and returns a list consisting of

In PYTHON image text in transcribed

Write a function add list (lstl, lst2) that takes two lists of numbers of the same length and returns a list consisting of the sum of the first numbers, the sum of the second numbers, etc. For example add_list ([1,2,3], [4,5, 6]) should return the list [5, 7, 9] since 1+ 4 is 5, 2 +5 is 7, etc. Your main program should prompt user for input. It should read a list of numbers, one number per line, followed by "done", then another list of numbers, one per line, followed by done. If the lists have different lengths, your main program should print "Lists are different lengths." If they are the same length, the main program should call add ?1st and print the resulting list, one number per line Note: you may define additional functions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions