Pattern - X to Y Rotate
Coding Problem Keys
Pattern - X to Y Rotate
Problem Statement
The program must accept two integers X and Y and print the pattern described in the Example Input/Output section.
Input Format
The first line contains X and Y separated by a space.
Output Format
The Y-X+1 lines containing the desired pattern.
Boundary Condition(s)
2 <= X, Y <= 100
X < Y
Example Input/Output 1
Input
5 10
Output
5 6 7 8 9 10
6 7 8 9 10 5
7 8 9 10 5 6
8 9 10 5 6 7
9 10 5 6 7 8
10 5 6 7 8 9
Note: Max Execution Time Limit: 5000 millisecs
Solution
Programming Language: Python 3 Language
a,b=map(int,input().split()) l=[i for i in range(a,b+1)] for i in range((b-a)+1): print(*l) l=l[1:]+[l[0]]# Published By PKJCODERS
Programming Language: Python 3 Language
# Published By PKJCODERSx,y=map(int,input().split()) l=[i for i in range(x,y+1)] for i in range(y-x+1): print(*l) l.append(l.pop(0))
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments