Python Porgramming List Comprehension

 

Convert the following from a list comprehension to a non-comprehension, i.e. regular Python code.

Hint: Use 2 nested for loops

x1 = [1,2]
x2 = [3,4]

print("B:", [(x, y) for x in x1 for y in x2])
Output:
B: [(1, 3), (1, 4), (2, 3), (2, 4)]
Tags: No tags