python输出三角形

# -*- coding: utf-8 -*-
# @Time : 2022/2/22 16:18
# @Author : Relieved


"""
line : 行数
Difference :差值
multiple : 倍率

"""


class OutStart:

    @staticmethod
    def RunAll(line=1, Difference=1, multiple=1):
        i = 1
        while i < line:
            j = 0
            while j < i:
                print("*", end="")
                j += 1
            print("")
            i = (i + Difference) * multiple


if __name__ == '__main__':
    try:
        vLine = int(input("vLine : 1 - 99"))
        vDifference = int(input("vDifference : 1 - 9"))
        vMultiple = int(input("vMultiple : 1 - 9"))
        if (1 <= vLine <= 99) or (1 <= vDifference <= 9) or (1 <= vMultiple <= 9):
            OutStart.RunAll(line=vLine, Difference=vDifference, multiple=vMultiple)
        else:
            print("Error : > Incorrect input <")
    except Exception as e:
        print(">>> ", e)

上一篇:labelimg切换图片时数组越界


下一篇:【编程积累】在tensorboard里绘制多条曲线