Computer Science, asked by priyadarshinimd253, 10 months ago

Pattern - X to Y Forward & Reverse (EASY) (Id-3180)
Author: SKILLRACK
For a given value of X and Y, print the pattern as explained in the Example Input/Outpu
Input Format:
The first line contains X, Y separated by a space.
Output Format:
The pattern as explained in the Example Input/Output section.
Boundary Conditions:
1 <= X Y <= 100
Example Input/Output 1:
Input:
15
Output:
12345
11345
11145​

Answers

Answered by mohammadakram50013
4

Answer:

i cant understand your question

Explanation:

Answered by sarahssynergy
2

Given below is required program for the given pattern printing in Python programming language.

Explanation:

  • here the pattern is such that in the first line all the consecutive integers between the input integers including them are printed.
  • Then in consecutive next lines the successive places of integers is replaced by the first integer, until all are printed as the first integer.
  • for example , if input: 123 ->output: 123 (next line)113 (next line)111
  • PROGRAM:
  • x=int(input("enter first integer:"))
  • y=int(input("enter second integer"))
  • if (x>y):        
  • p=[i for i in range(y, x+1)]
  • else:          
  • p=[i for i in range(x, y+1)]
  • for k in range(len(p)):          
  • for j in range(k+1):                    
  •  p[j]=p[0]        
  • print(p, "\n")

Similar questions