¹ØÓÚÁбíÔªËصÄÎÊÌâ
ÔÚÈçͼËùʾµÄÇé¿öÏ£¬ÎªÊ²Ã´ÔËÐкó»á±ä³ÉÕâÑù
²»Ó¦¸ÃÊǽ«µÚ1ÐеĵÚ1¸öÔªËظijÉ1Âð£¿ÎªÊ²Ã´ÈýÐж¼¸Ä±äÁË£¿
¸½ÉÏ´úÂ룺
def get_basic_map(x,y):
result=y*]
result=*x
result[-1]=*x
for i in range(1,y-1):
if i%2!=0:
for j in range(x):
if j%2!=0:
result=1
return result
def show_map(map):
for i in map:
for j in i:
print(j,end=' ')
print()
# s=input('size:').split(',')
# x,y=int(s),int(s)
map=get_basic_map(5,5)
show_map(map)
ÄãµÄµÚÒ»²ãÑ»·Ê±±éÀúÐУ¬µÚ¶þ²ãÑ»·Ê±±éÀúÁÐ
ÁбíµÚÒ»ÐеÄϱêÊÇ0£¬ÄãÕâ´Ó1¿ªÊ¼¿Ï¶¨ÊDz»¶ÔµÄ
range()ÊÇ×ó¿ªÓÒ±Õ£¬range(1,4)= 1 2 3 ´óÂíÇ¿ ·¢±íÓÚ 2022-1-7 12:57
ÄãµÄµÚÒ»²ãÑ»·Ê±±éÀúÐУ¬µÚ¶þ²ãÑ»·Ê±±éÀúÁÐ
ÁбíµÚÒ»ÐеÄϱêÊÇ0£¬ÄãÕâ´Ó1¿ªÊ¼¿Ï¶¨ÊDz»¶ÔµÄ
range()ÊÇ ...
ÎÒÕâ¸ö¾ÍÊÇÒª´ÓµÚ¶þÐпªÊ¼µ½µ¹ÊýµÚ¶þÐнáÊøµÄ¡£ËùÒÔÎÒ²ÅÕâÑùд
ÎÒÏëÖªµÀµÄÊÇΪʲôresult»á°ÑÈýÐÐÊý¾Ý¶¼¸ÄÁË£¿ ±¾Ìû×îºóÓÉ hrpzcf ÓÚ 2022-1-7 13:33 ±à¼
y*]´´½¨µÄy¸ö×ÓÁÐ±í¶¼ÊÇͬһµØÖ·µÄÁÐ±í£¬¿ÉÒÔÕâÑù£º
result = for _ in range(y)] Â¥ÉÏÕý½âÄãµÄÈýÐж¼ÊÇÒ»¸öÄÚ´æµØÖ·
Ò³:
[1]