Answer to Question #302002 in Python for Vini

Question #302002

Question #301749



Write a program to print W pattern of N lines using a asterisk(*) character






NOTE : There is a space after each asterisk (*) character.








Input:






The first line is an integer N








Explanation:






For N=5






The output should be




* * * * * * * * *



* * * * * * * *



* * * * * *



* * * *



* *

1
Expert's answer
2022-02-24T08:07:07-0500
'''
    Write a program to print W pattern of N lines using a asterisk(*) character
    NOTE : There is a space after each asterisk (*) character.
    Input:
    The first line is an integer N
    Explanation:
    For N=5
    The output should be
    * * * * * * * * *
    * * * * * * * *
    * * * * * *
    * * * *
    * *
'''


N = int(input("Enter N = "))


u = (2*N)-1
for r in range(0,N):
    s=""
    for c in range(0,u): s = s + "* "
    if(r==0):   u = u-1
    else:
        u = u-2
    print(s)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS