Answers for "create range function in python"

16

making your own range function with step in python

def range_with_step(start_num,end_num,step_num):
    sequence2 = [start_num]
    while start_num < end_num:
        start_num += step_num
        sequence2.append(start_num)
    return sequence2
print(range_with_step(0,6,3))
Posted by: Guest on June-30-2021
3

range python

range(4)        # [0, 1, 2, 3] 0 through 4, excluding 4
range(1, 4)     # [1, 2, 3] 1 through 4, excluding 4
range(1, 10, 2) # [1, 3, 5, 7, 9] 1 through 10, counting by 2s
Posted by: Guest on May-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language