Print a triangular pattern of asterisks

后端 未结 15 1024
慢半拍i
慢半拍i 2020-11-30 11:01

I am required to use nested for loops and print(\'*\', end=\' \') to create the pattern shown here:

And here is my code. I have figured out the first t

15条回答
  •  执笔经年
    2020-11-30 11:31

    for i in range(1,n+1): print '{:>{}}'.format('#'*i, n)
    this is For pattern D
    
    
    for i in range(1,n-1): print '{:>{}}'.format('#'*i, n)
    this is For pattern c
    

提交回复
热议问题