Skip to content
Advertisement

How to generate a list of numbers in python

guys. I am now working on a python algorithm and I am new to python. I’d like to generate a list of numbers like 4, 7, 8, 11, 12, 13, 16, 17, 18, 19, 22, 23, 24, 25... with 2 for loops.

I’ve done some work to find some numbers and I am close to the result I want, which is generate a list contains this numbers

My code is here:

JavaScript

Node is a list:

JavaScript

What I received from this code is:

JavaScript

Advertisement

Answer

This seems to give the same list: and I think it’s much clearer what’s happening!

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement