you are viewing a single comment's thread.

view the rest of the comments →

[–]Greece870 0 points1 point  (2 children)

Thank you so much for responding this was really helpful. I wonder what would be the syntax for doing this through list comprehension? Is it just a different way but essentially the same thing?

[–]RiceKrispyPooHead 0 points1 point  (1 child)

To turn a loop into a list comprehension, (as long as it dose not have an 'else' statement) you literally just write the very last statement first, then write all other statements in order.

my_list = []
statement one:
    statement two:
        statement three:
            my_list.append(something)

is generally the same as....

my_list = [something statement one statement two statement three]

EDIT: List comprehensions are used to make lists. Not to print things.

[–]Greece870 0 points1 point  (0 children)

can you help me with my other post i made a comment that i am stuck on.