Python Forum
question about list comprehension
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question about list comprehension
#1
I am practicing for the python PCAP exam and i don't understand this excercise:

How many empty lines will the following snippet send to the console?
l = [[c for c in range(r)] for r in range(3)]
for x in l:
    if len(x) < 2:
    print()
I do understand easy list comprehensions but not this one with c for c in range®.

If someone could explain this I would be very thankful.
Reply


Messages In This Thread
question about list comprehension - by adriaanNL - Sep-09-2018, 03:41 PM
RE: question about list comprehension - by buran - Sep-09-2018, 04:03 PM

Forum Jump:

User Panel Messages

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