Reputation: 6975
Can I make a list of numbers from 1 to 6 in one line without a loop?
goal:
[1,2,3,4,5,6]
Upvotes: 1
Views: 382
Reputation: 60053
Use the range builtin.
range
range(1, 7)
Upvotes: 0
Reputation: 6981
Yes, use:
range(1,7)
that should do it.
Upvotes: 4