Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to make your own range function in python

# subcribe to my channel 
# https://www.youtube.com/channel/UCakNP54ab_3Qm8MPdlG4Zag
def own_range(start=0, end=0, step=1):
	if step == 0:
		raise ValueError("own_range() arg 3 must be not zero")
	if start > end and step < 0:
		while start > end:
			yield start 
			start += step
	elif start > end or (start != 0 or end == 0) and start != 0 and end == 0:
		while end < start:
			yield end
			end += step
	elif start == 0 and end != 0 and end > 0 and step > 0 or (start != 0 or end == 0) and start != 0 and start < end and step > 0:
		while start < end:
			yield start
			start += step
 
PREVIOUS NEXT
Tagged: #range #function #python
ADD COMMENT
Topic
Name
6+7 =