Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to create chess board numpy

import numpy as np

a=np.array(([1,0]*4+[0,1]*4)*4).reshape((8,8))
print(a)

#
[[1 0 1 0 1 0 1 0]
 [0 1 0 1 0 1 0 1]
 [1 0 1 0 1 0 1 0]
 [0 1 0 1 0 1 0 1]
 [1 0 1 0 1 0 1 0]
 [0 1 0 1 0 1 0 1]
 [1 0 1 0 1 0 1 0]
 [0 1 0 1 0 1 0 1]]
Comment

PREVIOUS NEXT
Code Example
Python :: python find most occuring element 
Python :: python code to drop columns from dataframe 
Python :: get self file name in python 
Python :: List comprehension - list files with extension in a directory 
Python :: how to make a discord bot dm someone python 
Python :: python get webpage source 
Python :: Write a Python program to append text to a file and display the text. 
Python :: dataframe to txt 
Python :: jupyter read in csv 
Python :: python convert latitude longitude to x y 
Python :: recursionerror maximum recursion depth 
Python :: python split string capital letters 
Python :: convert dictionary keys to int python 
Python :: discord.py change status 
Python :: tkinter window to start maximized 
Python :: convert integer to datetime in python 
Python :: python parsing meaning 
Python :: pandas not is na 
Python :: calculate mape python 
Python :: iterate over rows dataframe 
Python :: how to make otp generator in python 
Python :: mp4 to wav python 
Python :: python fiscal year prior 
Python :: python use .env 
Python :: Could not locate a bind configured on mapper mapped class class-tablename, SQL expression or this Session. 
Python :: rolling average df 
Python :: print terminal url 
Python :: delete files inside folder python 
Python :: reverse list python 
Python :: python write yaml 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =