QUESTION IMAGE
Question
question: 1 which of the following is the correct way to have karel paint a red square using the paint function?
option 1: paint_red()
option 2: paint_color.red()
option 3: paint(color
ed\)
option 4: paint(colorred)
In Karel programming (a beginner CS environment), the paint function takes a color value passed as a string inside brackets, formatted as paint(color["color_name"]). The other options use incorrect syntax: paint_red() is a non-standard custom function name, paint_color.red() uses invalid dot notation for this context, and paint(color[red]) omits quotes around the color string, which would be treated as an undefined variable.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
○ paint(color["red"])