打印字符串 如:*********

print(“-”*50)

结果如下:

字符串若乘上整数n,将返回由n个这样的字符拼接而成的字符。

例如:

#!/usr/bin/env python3
row=int(input("Enter the number of rows: "))
n=row
while n>=0:
    x="*"*n
    y=" "*(row-n)
    print(y+x)
    n -=1

 

posted @ 2017-08-11 11:05  black-bird  阅读(180)  评论(0编辑  收藏  举报