"Series - 2: Given two integers A and B. Print all numbers from A to B inclusively, in ascending order, if A < B, or in descending order, if A ≥ B. " - Snackify python coding question

 

 

 


 

CODING QUESTION

Given two integers A and B. Print all numbers from A to B inclusively, in ascending order, if A < B, or in descending order, if A ≥ B.


SOLUTION

a=int(input())
b=int(input())
if a<b:
    o=1
else:
    o=-1
for i in range(a,b+o,o):
    print(i)

 

Input : 

1
10


Output : 

1
2
3
4
5
6
7
8
9
10