Launch Blender, and switch to Scripting view. In the Console, complete each of t
ID: 3596787 • Letter: L
Question
Launch Blender, and switch to Scripting view. In the Console, complete each of the following tasks: 1. Each square on a chess board can be described by a letter and number, such as g5 in this example: a b cd e f g h 7 6 a bcd e f g h The color of a square can be determined as follows: .For letters a, c, e or g: if the number is odd, the square is black; otherwise, it's white For letters b, d, f or h: if the number is even, the square is white; otherwise, it's black Note that an even number is defined as evenly divisible by 2, so the remainder of an even number divided by 2 will always be 0 Write a Python function that, given the letter and number of a square, returns its color as a string (i.e, either "black" or "white) Paste your function definition with some sample outputs here:Explanation / Answer
def squareonchess( char ):
"This prints a passed info into this function"
list1 = ["a", "c", "e", "g"]
list2 = ["b", "d", "f", "h"]
num = int(char[1])
r = num % 2
c = char[0]
if c is list1:
if r == 1:
str = "Black"
else:
str = "White"
else:
if r == 1:
str = "Black"
else:
str = "White"
return str;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.