打印字符串 如:*********
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
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