Question: Write a function, called allPairs, that takes two lists as parameters, x and y, and returns a new list containing all possible pairs consisting of

Write a function, called allPairs, that takes two lists as parameters, x and y, and returns a new list containing all possible pairs consisting of one element from x and one element from y, as long as they are not the same element. Cannot use built-in functions or sets. For example: If the list x = [1, 4, 6, 8] and y = [5, 2, 6] then the result is the list [(1, 5) , (1, 2), (1, 6), (4, 5), (4, 2), (4, 6), (6, 5), (6, 2), (8, 5), (8, 2), (8, 6)]. Note that (6, 6) doesn't appear because they are the same element

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!