Computer Science, asked by somya8591, 8 months ago

write a python program to print the series as 4321,432,43,4

Answers

Answered by chiefprashant
9

Answer:

#Python

Explanation:

def f(n):

a=4

b= ''

while a >0:

for i in range(a,0,-1):

b += str(i)

print(b)

a -= 1

b = ""

f(10)

Answered by AskewTronics
7

Following are the program in python for the above question:

Explanation:

size= int(input("Enter the value for the size of the series: ")) #to enter the size from the user.

for i in range(1,size): #first for loop which prints for the height of the series.

   for j in range(size,i-1,-1): #second for loop to print the weidth of the series.

       print(j,end="") #print the series.

   print(end=", ")#it is used to place the comma after the series.

print(size) #it is used to print the lat step of the series.

Output:

  • If the user inputs 3, then the output is 321, 32, 3.
  • If the user inputs 4, then the output is above defined series.

Code Explantion:

  • The above code is in python language which takes the size of the series as input and then it prints the series in the question demand format.
  • There are two for loop one is used to print the size of the series and the other is used to print the width of the series.
  • The last statement is used to print the element because the above statement holds the ',' with the series.

Learn More:

  • Python : https://brainly.in/question/14689905
Similar questions