Write a Python program that prompts the user for the colours of the rainbow (red, orange,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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) 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)
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that prompts the user for the colors of the rainbow validates the input and t... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a Java program that prompts the user for the page size used in a virtual memory system; this will be a power of two between 512 (2^9) and 16384 (2^14), inclusive. Your program should check the...
-
Write an application that prompts the user for a Write f = u + iv and assume that f has a derivative at each point of an open disk D centered at (0, 0). If au 2 + bv 2 is constant on D for some real...
-
Write an input validation loop that prompts the user to enter a whole number between 3 and 9.
-
At t = 0, a particle is traveling parallel to very large insulating plate at a 0.360 m distance with a speed of 980 m/s. Consider that the insulating plate has uniform surface charge density 2.34. x...
-
Assets = Liabilities + Owners equity. How would you restate this equation if you wanted to know what your liabilities are? Your owners equity?
-
How do macroeconomic factors, including fiscal policy interventions, monetary stimulus measures, and systemic risk mitigation strategies, interact with microeconomic variables, such as firm-specific...
-
Discuss the objectives and classification of criminal offenses.
-
Clott was chairman and chief executive officer of First American Mortgage Company, Inc. (FAMCO), which originated loans and sold the loans to investors, including E. F. Hutton Mortgage Corp....
-
You want to begin saving for your daughter to go to graduate school at Oklahoma starting 10 years from now. You expect that you will need to make tuition payments of $3.000 per month for the two...
-
This problem continues the process of preparing the Kipley Company's Employee Payroll Register for the pay period ending January 8th, 20--. In previous chapters, gross wages were computed for each...
-
. A marketing research company found that 6 percent of its clients generated 30 percent of sales and nearly all of its profits. At the other end of the contin- uum, 70 percent of its clients provided...
-
4x X with x being Suppose a fishery characterized by a growth function g = 5 3200 the biomass level; r = 4/5 the intrinsic growth rate; and, k= 3200 the carrying capacity . Q1. Determine the maximum...
-
Lester and Stephen formed a partnership with capital contributions of P300,000 and P700,000, respectively. During its first year of operations, the partnership earned a profit of P200,000. Prepare a...
-
Your line manager, Ms Lionheart, has collected and scrutinised performance data for the company. She was concerned that the inventories were high for certain products which had resulted in...
-
Country A (rich in labor) and country B (rich in capital) produce good X (labor-intensive) and good Y (capital-intensive). Before trading, the equilibrium points of the closed economy of the two...
-
Given the following vector of state probabilities and the accompanying matrix of transition probabilities, find the next period vector of state probabilities. (0.2 0.3 0.5) [0.6 0.2 0.2] 0.1 0.7 0.2...
-
What is the PVA of an ordinary annuity with 10 payments of $100 if the appropriate interest rate is 10%? What would the PVA be if the interest rate was 4%? What if the interest rate was 0%? How would...
-
What do you think?
-
If M = 7, s = 2, and X = 9.5, what is z?
-
If N = 18, M = 12, = 10, and s = 1, what is t?
-
The direction of the results for a chi-square goodness-of-fit test needs to be determined if the results are ____.
-
Why does spreading feet apart help a surfer stay on the board?
-
Why will a projectile that moves horizontally at 8 km/s follow a curve that matches the curvature of Earth?
-
How much speed does a freely falling object gain during each second of fall?
Study smarter with the SolutionInn App