General Programming Discussion

8734 readers
14 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 6 years ago
MODERATORS
401
402
403
404
405
406
407
408
409
 
 

r/programming comments

410
411
412
413
414
415
416
 
 

We have been using a self-hosted drone for a long time, and now they're telling us we need to purchase a license 💩

417
418
419
420
421
 
 
422
423
424
425
 
 

So I'm trying to make a list of numbers that are multiples of 3, this is my code:

multiples_of_3 = []
for value in range(3, 31):
    number = value % 3 == 0
    multiples_of_3.append(number)

print(multiples_of_3)

But it transforms the results into booleans, which throws me a list with false and trues instead of numbers, what I'm doing wrong? I know comprehension lists exist and that this could be done more efficiently but well, I'm trying to learn and writing it as a comprehension list doesn't make it easier.

view more: ‹ prev next ›