Python/Basic/chick_python_exam/Unit1_basic/program/multiplicationTable_v2.py

19 lines
498 B
Python
Raw Normal View History

#Program: multiplicationTable_v2.py (Report comments/bugs to chikh@yuntech.edu.tw)
#Function:
print("\n九九乘法表\n")
print(" |",end='')
for i in range(1,10):
print(" ",i,end='')
print("\n----+-----------------------------------------------")
for i in range(1,10):
print(" ",i,"|",end='')
for j in range(1,10):
if j < i:
print(" ",end='')
continue
print(" " if i*j < 10 else " ",i*j,end='')
print()
print("----+-----------------------------------------------")