Python problem:
1. 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, as shown here:
Create a text file with the names of two colors in it. Write a program that reads the file and replaces the colors with the color that they combine to produce. In other words, if the text file contains "blue" and "yellow," after you run your program, it should only contain the word "green."
2. Make a text file with a column of numbers (however many, it doesn't matter) in no particular order. Write a program that reads that file and re-orders the numbers from highest to lowest and saves that back in the file.

OUTPUT :

CODE :
f1 = open('colors.txt','r+')
colors = f1.readline().split()
a = colors[0]
b = colors[1]
c = ''
#Check for colors and store ans
if a=='red' and b=='blue':
c = 'purple'
if a=='red' and b=='yellow':
c = 'orange'
if a=='blue' and b=='yellow':
c = 'green'
#Clear existing contents
f1.seek(0)
f1.truncate()
#Write to file
f1.write(c)
f1.flush()
f1.close()
===========================================

OUTPUT :

CODE :
#Read numbers
f = open('numbers.txt','r+')
#List to store numbers
l = []
#read all numbers
for line in f:
#add to list
n = int(line)
l.append(n)
#Clear the existing contents
l.sort()
f.seek(0)
f.truncate()
#Write sorted list to file
for line in l:
f.write(str(line)+'\n')
f.flush()
f.close()
Python problem: 1. The colors red, blue, and yellow are known as the primary colors because...
Using C++ COLOR MIXER- The color red, yellow, and blue are primary colors because they cannot be made by mixing other colors. When you mix 2 primary colors you get the following: 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. Write a program to ask the user for 2 primary colors (an error if they are not primary). Then display the...
Directions: Complete all the three programming assignments below. Please be sure to follow the programming rubric provided. Turn in three separate “.py" files. Be sure to run your programs before submission. Color Mixer The colors red, blue, and yellow are called primary colors, because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here: • When you mix red and blue, you get purple. • When you mix...
Using yellow, cyan, and magenta as primary colors, express green, red, and blue in the vector form.
python
Write a program that reads the name of fruits and the colors from an input file fruit. txt. Each fruit name and the color is given on a line as shown below separated by space Apple Red Orange Orange Grape Green Now write output to an output file (fruit2.txt) as shown below Color of Apple is Red Color of Orange is Orange Color of Grape is Green The program has to be general to read in as many lines...
yellow red green orange purple blue Select the color of the solution using the indicator thymol blue. When you first add indicator to your Na2CO3 solution, the color is blue When you reached the first equivalence point when moles of acid equals moles of base, the color is orange x. When you weren't paying attention and added too much HCl, the color is purple lx. When you really weren't paying attention and reached the second equivalence point, which is NOT...
Plain M&M's come in 6 different colors (Blue, Orange, Green, Yellow, Red, Brown) and are produced at two different plants. M&M's that come from a plant in Tennessee are supposed to have the following distribution of colors: 20.7% Blue; 20.5% Orange; 19.8% Green; 13.5% Yellow; 13.1% Red and 12.4% Brown. Quality control at the plant is concerned the machine is not working correctly and that it is producing a different distribution of colors. They take a random sample of 940...
1. What colors would be reflected by an orange tab if you placed it in red, green, or blue light? Justify your response with the results you had for red and yellow tabs in red, green, and blue 2.If you have a yellow light source and every color filter to use, could you produce every other possible color? Explain. 3. If an object is 20 cm from a lens and the image is formed 10 cm behind the lens, what...
Which of the following visible colors of light has the highest frequency? blue orange O red yellow green
Plain M&M’s candies come in six colors: yellow, red, orange, brown, blue, and green. The makers of M&M’s say that 20% of the produced candies are yellow, 20% are red, 20% are orange, 15% are brown, 15% are blue, and the rest of the produced candies are green. Given what you know about probability and probability models, which one of the following statements is correct? A More than 10% of the produced candies must be green. B If we randomly...
Plain M&M's candies come in six colors: yellow, red, orange, brown, blue, and green. The makers of M&M's say that 20% of the produced candies are yellow, 20% are red, 20% are orange, 15% are brown, 15% are blue, and the rest of the produced candies are green. Given what you know about probability and probability models, which one of the following statements is correct? The proportion of produced candies that are brown is 0.015. If we randomly select one...