n = int(input("input a num:")) i = n while i >0: x = "*" * i y = " " * (n-i) print(y+x) i -= 1
运行结果: