Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def loops(value_1,value_2,step,iterable):
- if (value_1 > value_2 and step > 0):
- print("Output for 'for' loop: ")
- for i in range(value_2,value_1 + 1,step):
- print(i, end=" ")
- elif value_1 > value_2 and step < 0:
- print("Output for 'for' loop: ")
- for i in range(value_1, value_2 - 1, step):
- print(i, end=" ")
- if value_1 < value_2 and step > 0:
- for i in range(value_1, value_2 + 1, step):
- print(i, end=" ")
- elif value_1 < value_2 and step < 0:
- for i in range(value_2, value_1 +1, step):
- print(i, end= " ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement