Question: Write a Python program that prompts the user for the colours of the rainbow (red, orange, yellow, green, blue, indigo, violet). The user is

Write a Python program that prompts the user for the colours of the rainbow (red, orange, yellow, green, blue, indigo, violet). The user is to enter the colour one at a time. Should the user enters an incorrect input, inform the user that the colour entered is not a colour of the rainbow. If the user entered a maximum of 3 wrong colours, the program is terminated. Sample screens are as below: When the user managed to enter all correct colours. Enter the colour of the rainbow: yellow Enter the colour of the rainbow: Blue Enter the colour of the rainbow: Green Enter the colour of the rainbow: RED Enter the colour of the rainbow: Indigo Enter the colour of the rainbow: violet Enter the colour of the rainbow: ORANGE You got all the colours right! Great job! >>> When the user entered 3 wrong input values. Enter the colour of the rainbow: yellow Enter the colour of the rainbow: Orange Enter the colour of the rainbow: black black is not a colour of the rainbow. Enter the colour of the rainbow: Blue Enter the colour of the rainbow: RED Enter the colour of the rainbow: white white is not a colour of the rainbow. Enter the colour of the rainbow: Cyan Cyan is not a colour of the rainbow. You have entered 3 wrong colours. Sorry. Try again. You did not mention: - green - indigo - violet < < < Hint: you might prefer to implement list in your program (append and/or remove functions might be used)
Step by Step Solution
3.52 Rating (155 Votes )
There are 3 Steps involved in it
Heres a Python program that prompts the user for the colors of the rainbow validates the input and t... View full answer
Get step-by-step solutions from verified subject matter experts
