code to explanationWed, 30 Nov 2022

def rainbow(): colours = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'] for colour in colours: print(colour)

The function rainbow returns a list of colours. It prints each colour in the list.

Questions about programming?Chat with your personal AI assistant