Just need the correct Answer(s), Both blanks have the same answers options as sh
ID: 3742074 • Letter: J
Question
Just need the correct Answer(s), Both blanks have the same answers options as shown in image 2.
QUESTION 3 In Python, colours can be represented in a number of ways: as the colour name (a string), as a hexadecimal number (string preceded with "#"), and as RGB values (a sequence of 3 integers in the range 0 to 255 inclusive, each representing one of (R)ed, (G)reen and (B)lue). Consider the following Python data structure, which contains data representing the name, hexadecimal value and RGB values of some colours: colours- [ [ 'black' , ' #000000' , '#FFFFFF', [0, 0, 0] ] , [250, 250, 250]], ['white', [ ' red' , ' #FF0000 ' , [250, 0, 0] ] , ['green', '#00FF00 ' , [0, 250,011, ['blue', 0000FF,0,0, 250])1 1. Complete the following code to produce a list of all the RGB values in the list colaur (eg.. [[o, o, 0, [250, 250, 250] rgb_palletter for rgb_pallette.append(Explanation / Answer
colours = [['black', '#000000', [0,0,0]],
['white', '#FFFFFF', [250,250,250]],
['red', '#FF0000', [250,0,0]],
['green', '#00FF00', [0,250,0]],
['blue', '#0000FF', [0,0,250]]]
rgb_pallette = []
for colour in colours:
rgb_pallette.append(colour[2])
print(rgb_pallette)
# Output: [[0, 0, 0], [250, 250, 250], [250, 0, 0], [0, 250, 0], [0, 0, 250]]
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.