id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

getChessSquareColor


Write a getChessSquareColor() function that has parameters column and row. The function either returns 'black' or 'white' depending on the color at the specified column and row. Chess boards are 8 x 8 spaces in size, and the columns and rows in this program begin at 0 and end at 7.

https://drive.google.com/file/d/1xZYUddv6-t_rw36v8YLp48V7L5Z6Cweh/view?usp=sharing
Note that chessboards always have a white square in the top left corner. If the arguments for column or row are outside the 0 to 7 range, the function returns a blank string.


getChessSquareColor(0, 0) → 'white'
getChessSquareColor(1, 0) → 'black'
getChessSquareColor(0, 1) → 'black'

...Save, Compile, Run (ctrl-enter)

def getChessSquareColor(column, row):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 201 Post-solution available

Copyright Nick Parlante 2017 - privacy