-2

i have three arrays.

a=[5, 4, 5]
b=[4, 6, 9]
c=[10, 5, 8]

I need to identify each matrix with a color

a=1=yellow
b=2=blue
c=3= green

and finally I need to create a fourth matrix that has the highest values ​​of each of the previous matrices

New array(whit lager numbers of the arrays a, b and c)=

d=[10, 6, 9]

but a need map of array "d" whit colors, in numbers is

d=[3, 2, 2]
d=[green, blue, blue]

I hope help me.

Thanks

1 Answers1

0

I suggest you first think about what you are going to name the data in your program and how you are going to organize it.

For example, "a" can't be "[5, 4, 5]", "1", and "yellow" at the same time unless you do some work packing and unpacking.

Similarly, "d" can't be "[10, 6, 9]", "[3, 2, 2]", and "[green, blue, blue]" at the same time.

It's better to break your data into chunks that are easier to manipulate and choose good names for them.

Then, how are you going to determine the maximum value in each "column"?

Hint: start with the values in "a" [5, 4, 5] and compare the others to see if any are larger.

Finally, how will you keep track of where each maximum value came from so you can capture the relevant color?

Something else to consider: Python indexes start at 0. If you decide to use an index for color, do you want it to start at 1? (i.e. yellow = 1)

lcongdon
  • 36
  • 4