Lab 3 Attached Files: · InputValidation.py (911 B) Make sure to include the "flower box" in your source code. Use comments for internal documentation explaining what you did and why you did it. You...

Python Computer languageEasy labs which can be googled


Lab 3 Attached Files: ·  InputValidation.py (911 B) Make sure to include the "flower box" in your source code.  Use comments for internal documentation explaining what you did and why you did it. You don't need a comment for each statement, but consider comments for the input section, processing section, and output section. Program Requirements The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color: When you mix red and blue, you get purple. When you mix red and yellow, you get orange. When you mix blue and yellow, you get green. Design a program that prompts the user to enter the names of two primary colors, one at a time. If the user enters anything other than "red," "blue," or "yellow," the program should print "You didn't input two primary colors." Otherwise, it should print something in the format: "When you mix red and blue, you get purple." (Assuming the user entered "red" and "blue”.) Lab 2 You decide to buy some stocks for a certain price and then sell them at another price. Write a program that determines whether or not the transaction was profitable. Here are the details: • Take three separate inputs: the number of shares, the purchase price of the stocks, and the sale price, in that order. • You purchase the number of stocks determined by the input. • When you purchase the stocks, you pay the price determined by the input. • You pay your stockbroker a commission of 3 percent on the amount paid for the stocks. • Later, you sell the all of the stocks for the price determined by the input. • You pay your stockbroker another commission of 3 percent on the amount you received for the stock.    Net Profit = Sales Price - Commission at Sale - (Purchase Price + Commission at Purchase) Your program should calculate your net gain or loss during this transaction and print it in the following format:  Print out the results of the calculations for the profit on the sale of your stock.  We will assume that a positive amount is a gain and a negative amount it a loss. Use string formatting.
Feb 20, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here