Question
use python do this problem Your task is to create a program that takes in the location (defined in the definitions file) of a chess
use python do this problem
Your task is to create a program that takes in the location (defined in the definitions file) of a chess board given in a letter-number coordinate and returns the color of the square. The chess board and coordinates are given below:
For example, for location = ‘A1’ the result should be color = ‘white’, while for location = ‘A2’ the result should be color = ‘black’. If a location is provided that is off the board, the result should be color = None. (Note that None is a keyword in Python not a string.) The location is case sensitive, so use uppercase letters. You may test different locations by modifying the value in definitions.py. You must first separate location into two components: letter (str) and number (int). The resulting square color is to be assigned to the variable color. Acceptable values are ‘white’ or ‘black’, both lowercase as well as None.
import numpy as np
from definitions import location, month, year, score_file, option
#%%=============================================================================
# Problem 1
# =============================================================================
# Separate location into two components
letter = None # variable of the type str
number = None # variable of the type int
# Write code that will output color based on the input location
color = None
definition:
7 8965 4 3 2 1 A B C D E F G H
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started