Answer: There are 5040 distinct ways that these balls can be ordered.
Explanation:
Since we have given that
Total number of balls = 7
According to question, each a different color of the rainbow in 7 balls.
We will use "Fundamental theorem of Counting " :
Number of distinct ways that these balls can be ordered is given by

So, there are 5040 distinct ways that these balls can be ordered.