-1

So I am defining a function that takes in one variable R. Then I need to create a list of all integers from 0 to R (in the context of the problem R will always be positive).

EX) When I do

R=5
print(list(0,R)) 

I just get a list with 2 elements: 0 and 5, but I want 0,1,2,3,4,5

buran
  • 13,682
  • 10
  • 36
  • 61

1 Answers1

0

The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number. range(6) would return [0,1,2,3,4,5]