Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1.     print("Output for 'for' loop: ")
  2.     if (value_1 > value_2 and step > 0):
  3.         for i in range(value_2,value_1 + 1,step):
  4.             print(i, end=" ")  
  5.     elif value_1 > value_2 and step < 0:
  6.         for i in range(value_1, value_2 - 1, step):    
  7.             print(i, end=" ")
  8.      
  9.  
  10.     if value_1 < value_2 and step > 0:
  11.         for i in range(value_1, value_2 - 1, step):
  12.             print(i, end=" ")
  13.     elif value_1 < value_2 and step < 0:
  14.         for i in range(value_2, value_1 - 1, step):
  15.             print(i, end= " ")
  16.    
  17.     while value_1 > value_2 and step > 0:
  18.         for i in range(value_2, value_1 + 1, step):
  19.             print(i, end=" ")
  20.             if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement