Question: Using python and while loop only, Write code that takes two lists of integers from the user, and returns all possible pairs of integers between
Using python and while loop only,
| Write code that takes two lists of integers from the user, and returns all possible pairs of integers between the two lists, without duplicates. In a pair, the smaller number must always come first. For example, if the lists were [1,2,3,4,5] and [2,3,4,5,6], your code would return the list of pairs ['1-2', '1-3', '1-4', '1-5', '1-6', '2-2', '2-3', '2-4', '2-5', '2-6', '3-3', '3-4', '3-5', '3-6', '4-4', '4-5', '4-6', '5-5', '5-6']. Template, def pairs(list1, list2): list1 = list1 list2 = list2 #YOUR CODE GOES HERE (indented) return [] #END YOUR CODE You may not use any built-in functions/methods besides len(), .append(), and str(). |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
