Python-programming-exercises icon indicating copy to clipboard operation
Python-programming-exercises copied to clipboard

List comprehension solution for Question 7

Open Sam-Gunawan opened this issue 4 years ago • 0 comments

I found a more efficient way of solving Question 7 using list comprehension. HOWEVER, this is not for beginners, it's just a fun way of solving it. Let me know what you think about my solution.

arrays, elems = map(int, input().split(','))
print([[i * j for j in range(elems)] for i in range(arrays)])

Sam-Gunawan avatar May 02 '21 13:05 Sam-Gunawan