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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started