4.5 while循环案例:九九乘法表

案例:

i = 1

while i <= 9:
    j = 1

    while j <= i:
        print(f"{j} * {i} = {i * j}\t", end='')
        j += 1

    print()
    i += 1

补充:输出不换行:print内容后面增加:, end=''

制表符:print内容中增加

Last updated

Was this helpful?