Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Translating this to a list comprehension?
Post: RE: Translating this to a list comprehension?

Oh, of course. Thanks! Working code: '\n'.join([''.join(['x' if (x, y) in some_collection else '-' for x in range(5)]) for y in range(2, -1, -1)])
gblomqvist General Coding Help 6 6,018 Dec-19-2016, 11:49 AM
    Thread: Translating this to a list comprehension?
Post: RE: Translating this to a list comprehension?

Oh, okay, completely understandable (I'm new to the forum **smile** ). If we say that some_collection is defined as follows: some_collection = {(3, 2), (0, 0), (2, 0), (2, 2), (4, 2), (1, 0)}Then fol...
gblomqvist General Coding Help 6 6,018 Dec-19-2016, 10:46 AM
  Smile Thread: Translating this to a list comprehension?
Post: RE: Translating this to a list comprehension?

If it's of any importance, it's a set consisting of tuples on the form (int, int). Thanks!  **wink**
gblomqvist General Coding Help 6 6,018 Dec-18-2016, 08:33 PM
    Thread: Translating this to a list comprehension?
Post: Translating this to a list comprehension?

Hi, Say that I have these for-loops: s = '' for y in range(a):     for x in range(b):         if (x, y) in some_collection:             s += 'x'         else:             s += '-'     s += '\n'I wa...
gblomqvist General Coding Help 6 6,018 Dec-18-2016, 06:55 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020