#pythonprogramming #pythontricks #pythontips #learnpython #pythonbeginner #pythonintermediate #pythonadvanced #pythoncode #pythondevelopment #pythonlearning #pythonlanguage #pythoncommunity #pythonforbeginners #pythonshorts #codingshort #programmingtips #programmingshorts #codinglife #codingcommunity #codingbootcamp
code below:
#Create a chess board
#using Matplotlib
import numpy as np
import matplotlib.pyplot as plt
#create a 8*8 numpy array with
#alternatin 1s and 0s
chessboard = np.zeros((8,8))
chessboard[::2, ::2] = 1
chessboard[1::2, 1::2]= 1
#ploat the chessboard using Matplotlib
plt.imshow(chessboard,cmap='binary')
plt.show()