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...
-
CVP analysis, shoe stores. The WalkRite Shoe Company operates a chain of shoe stores that sell 10 different styles of inexpensive men's shoes with identical unit costs and selling prices. A unit is...
-
Which histogram represents the data? 4, 6, 8, 12, 14, 16, 18, 24, 28, 30, 34, 36, 38, 40, 46, 50, 54 Responses A histogram with the vertical axis titled Frequency ranging from 0 to 8 in increments of...
-
Define par value stock. What is the significance of a stock's par value?
-
On April 15, 2010, Powell, Inc., obtained a six-month working capital loan from its bank. The face amount of the note signed by the treasurer was $300,000. The interest rate charged by the bank was...
-
VallasInc. has the following inventory activities: Vallas sold $6,400 of inventory to a customer, FOB Shipping Point. This inventory is currently in transit Vallas owns $10,000 of inventory as a...
-
After Chris completed the ratio analysis for S&S Air (see Chapter 3), Mark and Todd approached him about planning for next years sales. The company had historically used little planning for...
-
Using the information from the California Department of Justice Links to an external site., answer ALL of the following questions: What is the difference between a hate "incident" and a hate "crime"?...
-
1.A quantity of a particular raw material was purchased for P43,250. The standard cost of the material was P2/kg and there was an unfavorable materials price variance of P3,250. How many kilograms...
-
The following information is available from the tensile specimen of a material: Initial size: 0.505 in. diameter; 2.00 in. gage length. Final size: 0.300 in. minimum diameter; 0.420 in. diameter of...
-
Journal Entries, Un adjusted and adjusted entries You spent $748 incl. GST on miscellaneous office supplies at Officeworks. You paid for these from your bank accoun Office supplies on hand at 30th...
-
A compatible scan tool may be necessary to carry out fuel injector calibration for Common-Rail Diesel (CRD) engines. If the fuel injector calibration programming functions are not completed...
-
1 . What are the four steps of producing a cost of production report? Please also explain why this report matters. 2 . What does equivalent units of production ( EUP ) mean, and why is it necessary...
-
On the 1st of Jan 2023, ABC Company purchased equipment from the UK for a listed price of 200,000 KD with 10%. The company also paid the following expenses: 5,000 KD freight and insurance in transit...
-
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 ____.
-
Ashton Fleming has worked furiously for the past month trying to document the major business information flows at S&S. Upon completing his personal interviews with cash receipts clerks, Ashton asks...
-
A partially completed flowchart appears in Figure 3-13. The flowchart depicts the credit sales activities of the Bottom Manufacturing Corporation. A customers purchase order is received, and a...
-
Presentation Baker Corporation was organized on July 1, with an authorization of 50,000 shares of \(\$ 5\) no-par value preferred stock ( \(\$ 5\) is transactions affecting stockholders' equity...
Study smarter with the SolutionInn App