May-02-2020, 01:50 PM
(Mar-24-2020, 10:50 AM)PUP280 Wrote: Or again :Had you realized, the code is actually right just that the print statement is in the wrong place. It should be :
k = [] for w in h : for z in i : o = [w,z] k.append(o) print (k)Will give :
I’ve tried some tests with map, but nothing conclusive.
Output:[[[1, 2], 5]] [[[1, 2], 5], [[1, 2], 6]] [[[1, 2], 5], [[1, 2], 6], [[3, 4], 5]] [[[1, 2], 5], [[1, 2], 6], [[3, 4], 5], [[3, 4], 6]]
Can you help me please to solve my problem ?
H = [[1,2],[3,4]] I = [5,6] k = [] for w in H : for z in I : o = [w,z] k.append(o) print (k)And it gives output:
Output:[[[1, 2], 5], [[1, 2], 6], [[3, 4], 5], [[3, 4], 6]]
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs