Red to hex
Input
Color(255, 0, 0).hex
Output
#ff0000
Constructing a Color from RGB and reading hex returns lowercase 6-digit form with leading '#'.
Full lesson preview
Design a Color class that keeps RGB and hex representations in sync and validates updates via properties.
Problem statement
Task
Examples
Input
Color(255, 0, 0).hex
Output
#ff0000
Constructing a Color from RGB and reading hex returns lowercase 6-digit form with leading '#'.
Input format
Output format
Constraints
Samples
Input
Color(hex='#00ff00').g
Output
255
Parsing a hex string sets the G channel to 255.