Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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:
image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

What are the different techniques used in decision making?

Answered: 1 week ago