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