##1, Program analysis
Chess is 8*8 Of ,i(07) Representative bank ,j(07) Representative column . When i+j When it's odd , It's a black check , conversely , White check .

##2, Program implementation

<> Method 1 ： Double cycle

（1） program ：
for i in range(8): for j in range(8): if (i+j)%2!=0: print(chr(219)*2,end='')
else: print(' ',end='') print('')
（2） Effect display ：

<> Method 2 ： Circular printing of elements

（1） program
# Realize the circular movement of string def MoveLeft(string,n): n1=abs(n) length=len(string) n1= n1%length
# Number of cyclic shifts if n==0: # Do not move return string elif n<0: # Move left
string_n=string[n1:]+string[0:n1] else: # Move right
string_n=string[(length-n1):]+string[0:(length-n1)] return string_n #a='123456'
#b=MoveLeft(a,1) #print(b) def main(): a=' 11 11 11 11' i=0 while i<8: print(a)
a=MoveLeft(a,-2) i+=1 main()
（2） Experimental effect

(3) Program analysis
Method 2 uses the method of string cyclic movement , Compared with method one, it is more convenient

Technology
Daily Recommendation
views 2