Answers for "how to make your own range function in the python usin\"

11

making your own range function in python

def range_by(starting_number, ending_number):
    #sequence = [starting_number]
    sequence = []
    while starting_number < ending_number:
        sequence.append(starting_number)
        starting_number += 1
        
    return sequence

print(range_by(-3,6))
Posted by: Guest on June-30-2021
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
0

when do we use *range in python

print([*range(20)]) #will give all numbers 1 to 19 in a list
Posted by: Guest on January-15-2021

Code answers related to "how to make your own range function in the python usin\"

Python Answers by Framework

Browse Popular Code Answers by Language