Random RGB color generation
Write a function that every time a string in the formrgb()generate, so that three random numbers between 0 and 255 are placed inside the parentheses.
For example, the output may be as follows:
rgb(22, 38, 251)
Write a function that every time a string in the formrgb()generate, so that three random numbers between 0 and 255 are placed inside the parentheses.
For example, the output may be as follows:
rgb(22, 38, 251)
import random
def random_rgb():
return f"rgb({random.randint(0,255)}, {random.randint(0,255)}, {random.randint(0,255)})"
Submitting answers is currently unavailable.
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.