Question: Hey I am trying to create a python program that prints all the valid RGB values but I have to use 3 nested loop for

Hey I am trying to create a python program that prints all the valid RGB values but I have to use 3 nested loop

for example

RGB(0,0,0)

RGB(0,0,1)

RGB(0,0,2)

....

RGB(0,0,225)

RGB(0,1,0)

...

RGB(225,225,225)

I have created the code but it does not stop and I don't think its right would you be able to help me out figure out the problem please and thanks,

# !/usr/bin/env python3 # created by: Adam # created on: Nov 2020 # this program is the "RGB code" def main(): counter_number1 = 0 counter_number2 = 0 counter_number3 = 0 for counter_number1 in range(255): for counter_number2 in range(255): for counter_number3 in range(255): print("RGB ({0}, {1}, {2})".format (counter_number1, counter_number2, counter_number3)) if __name__ == "__main__": main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!