Python Discussion Forums

There's no such thing as a stupid question. Ask. Discuss. Learn.

I would like an explanation on this problem on how the zip function works

A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
[[col1 * col2 for (col1, col2) in zip(row1, row2)] for (row1, row2) in zip(A, B)]

Possible output

a) [0, 30, 60, 120, 160, 200, 300, 350, 400]
b) [[0, 30, 60], [120, 160, 200], [300, 350, 400]]
c) No output
d) Error

Sunil Kamat 9 months ago
  • Dinasbhai Dinasbhai

    I'm a beginner, and I don't know much about DLL's, applications, or how they're made, or how they really work. But recently I finished brainstorming an idea for my first application that's too good to pass up.

    I tried to teach myself python about a year ago, but I didn't last the first week of reading. Now that my idea is complete, I need to learn Python again, and I have that covered. All I'm asking this community is: How do I create an application like MS Word, MS Excel and others? I already researched this question and all I'm coming across is advice that isn't in Layman's terms, I can't understand what they're talking about.

    I already downloaded a GUI package called wxPython using pip. I followed a tutorial online about how to use the various widgets. But the tutorial didn't explain ALL of what each thing means, especially for a beginner like myself.

  • Joshua Paul

    Hi all,

    I have been trying to learn python but I can't seem to find the right course for me.

    I have no coding experience prior to my brief learning the past few weeks, but I can't find a course that fits me. I've tried datacamp, udacity and sololearn so far. None of them have provided me with solid educational content past the typical lists/for loops. fedloan

    Any recommendations on websites or courses that would help me go from nothing to something? I would eventually want to learn/be slightly knowledgeable in machine learning, if that's any help.

    Also, would prefer a free course but beggars can't be choosers. Thanks! easybib

    P.S. Looking at "Python Crash Course: A Hands-On, Project-Based Introduction to Programming" by Eric Matthes. If anyone can give feedback on that book, I would appreciate it!

  • Whitelisted Links