1. 程式人生 > >輸出一個矩陣,但這次是中空的

輸出一個矩陣,但這次是中空的

int() hang () int put 矩陣 print pre inpu

lie=int(input(‘lie:‘))
hang=int(input(‘hang:‘))
phang=1
while phang<=hang:
plie=1
if phang==1 or phang==hang:
while plie<=lie:
print(‘*‘,end=‘‘)
plie+=1
while plie<=lie:
if plie==1 or plie==lie:
print(‘*‘,end=‘‘)
else:print(‘ ‘,end=‘‘)
plie+=1
phang+=1
print()

輸出一個矩陣,但這次是中空的