Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started