Nov-04-2017, 06:03 PM
hi. i am looking to create a list [10,0,10,0]. up to now i have the following code:
mylist=[10 if i%2==1 else 0 for i in range(1,5)]the above returns [10,0,10,0]. Any ideas on how to fix that please?
list comprehension error
|
|
Messages In This Thread |
list comprehension error - by atux_null - Nov-04-2017, 06:03 PM
RE: list comprehension error - by buran - Nov-04-2017, 06:06 PM
RE: list comprehension error - by atux_null - Nov-04-2017, 07:44 PM
RE: list comprehension error - by buran - Nov-04-2017, 07:46 PM
RE: list comprehension error - by atux_null - Nov-04-2017, 08:03 PM
RE: list comprehension error - by buran - Nov-04-2017, 08:06 PM
RE: list comprehension error - by wavic - Nov-04-2017, 08:43 PM
RE: list comprehension error - by atux_null - Nov-04-2017, 09:54 PM
RE: list comprehension error - by Mekire - Nov-05-2017, 12:49 AM
|