1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anna71 [15]
3 years ago
8

5. Write a function that takes two lists of integers and returns a list containing tuples with corresponding elements from both

the lists. For example - f ([1, 2, 3], [4, 5, 6]) -> [(1, 4), (1,5), (1,6), (2, 4), (2, 5), (2, 6), (3, 4), (3 ,5), (3, 6)]. If either list is null, the result is null. The lists do not have to be the same length.
Computers and Technology
1 answer:
Allisa [31]3 years ago
7 0

Answer:

def corresponding_of_lists(lst1, lst2):

   c = ""

   corresponding_list = []

   if (lst1 is None) or (lst2 is None):

       return None

   else:

       for i in lst1:

           for j in lst2:

               c = "(" + str(i) + "," + str(j) + ")"

               corresponding_list.append(c)

   return corresponding_list

Explanation:

- Create a function called corresponding_of_lists that takes two lists as parameter

- Initialize an empty list to hold the corresponding values

- Check if any of the lists are null, if they are return None

- Otherwise, get the corresponding elements and put them into the corresponding_list

Return the corresponding_list

You might be interested in
Which of the following commands appears in the INSERT menu or tab?
loris [4]

Answer:

Table

Explanation:

3 0
3 years ago
In order to communicate between devices inside a computer?
labwork [276]
Seems to be a CPU, central processing unit

Handles transactions between on-board memory, as well as I/O (input/output) devices.
4 0
3 years ago
Special instruments can be attached to a telescope's _______________to enable astronomers to enhance by brightening or enlarging
Arte-miy333 [17]
I think it is D. eyepiece because what I know we can put a camera to the eyepiece
7 0
4 years ago
What is the name of the option in most presentation applications with which you can modify slide elements?
Alexeev081 [22]
Hello  <span>Meadowmilliganp1t1nj 
</span>
Question: <span>What is the name of the option in most presentation applications with which you can modify slide elements?

Answer: View Master

I hope I helped :-)
-Chris</span>
6 0
3 years ago
Read 2 more answers
What is the output of the following C++ program?
KIM [24]

Answer:

Output:<em> </em><em>15 11/16 inches</em>

Explanation:

#include <iostream>

using namespace std;

////////////////////////////////////////////////////////////////////////

class InchSize {

public:

   InchSize(int wholeInches = 0, int sixteenths = 0);

   void Print() const;

   InchSize operator+(InchSize rhs);

   

private:

   int inches;

   int sixteenths;

};

InchSize InchSize::operator+(InchSize rhs) {

   InchSize totalSize;

   totalSize.inches = inches + rhs.inches;

   totalSize.sixteenths = sixteenths + rhs.sixteenths;

   

   // If sixteenths is greater than an inch, carry 1 to inches.

   if (totalSize.sixteenths >= 16) {

       totalSize.inches += 1;

       totalSize.sixteenths -= 16;

   }

   return totalSize;

}

InchSize::InchSize(int wholeInches, int sixteenthsOfInch) {

   inches = wholeInches;

   sixteenths = sixteenthsOfInch;

}

void InchSize::Print() const {

   cout<<inches<<" "<<sixteenths<<"/16 inches"<<endl;

}

////////////////////////////////////////////////////////////////////////

int main() {

   InchSize size1(5, 13);

   InchSize size2(9, 14);

   InchSize sumSize;

   sumSize = size1 + size2;

   sumSize.Print();

   return 0;

}

////////////////////////////////////////////////////////////////////////

sumSize variable was printed in the end. Print() prints the calling object's inches and sixteenths variables' values.

sumSize's inches is equal to size1 plus size2's inches.

Because the sum of sixteenths was greater than 16, sumSize's sixteenth was decreased by 1 and inches was increased by 1.

3 0
4 years ago
Other questions:
  • Very often in data science, we are interested in understanding how values change with time. Use np.diff and np.max (or just max)
    13·1 answer
  • Before text can be formatted you must first
    10·2 answers
  • Explain The Two Way Communication in full.
    10·1 answer
  • Why do hard drives tend to slow down over time?
    11·2 answers
  • Because the data was formatted the same in two inventory files, you decided to combine their contents into one file. Now you wan
    7·1 answer
  • Create a program named Reverse3 whose Main() method declares three integers named firstInt, middleInt, and lastInt. Assign the f
    9·1 answer
  • PLEASE I NEED HELP PLEASE PLEASE<br> Which function prompts the user to enter information?
    9·1 answer
  • Which federal legislation prohibits credit card companies from raising rates on existing balances?
    10·2 answers
  • PI
    12·1 answer
  • A student is having trouble finding enough time in his busy schedule to work on his school science project. He has a demanding s
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!