Question

Directions: Complete all the three programming assignments below. Please be sure to follow the programming rubric provided. T
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE1:

1 2 3 4 5 6 7 8 9 LULUI Ilnput Enter the first primary color:). Lower() #taking two colors as input color2=input(Enter the

OUTPUT1:

jeswaanth@jeswaanth:-/Desktop$ python3 color_mixer.py Enter the first primary color:red Enter the Second primary color:blue W

Raw_Code1:

color1=input("Enter the First primary color:").lower()   #taking two colors as input
color2=input("Enter the Second primary color:").lower()
if(color1=='red' and color2=='blue') or (color1=='blue' and color2=='red'):
   print("When you mix red and blue,you get purple")       #checking required conditions
elif(color1=='red' and color2=='yellow') or (color1=='yellow' and color2=='red'):
   print("When you mix red and yellow,you get orange")
elif(color1=='blue' and color2=='yellow') or (color1=='yellow' and color2=='blue'):
   print("When you mix blue and yellow you get green")
else:   #printing error message if he enters color other than primary
   print("You have entered a color other than primary color")

CODE2:

1 2 3 4 length1 = int(input(Enter length of 1st rectangle:)) #taking two rectangels length and width as inputs width1 = in

OUTPUT2:

jeswaanth@jeswaanth:-/Desktop $ python3 area_of_rect.py Enter length of 1st rectangle: 1 Enter width of 1st rectangle:1 Ent

Raw_Code2:

length1 = int(input("Enter length of 1'st rectangle:")) #taking two rectangels length and width as inputs
width1 = int(input("Enter width of 1'st rectangle:"))
length2 = int(input("Enter length of 2'st rectangle:"))
width2 = int(input("Enter width of 2'st rectangle:"))

area_of_rect1=length1*width1
area_of_rect2=length2*width2       #calculating area of two rectangles

if(area_of_rect1>area_of_rect2):   #checking if rectangle 1 is greater
   print("The Rectangle 1 has greater area")
elif(area_of_rect2>area_of_rect1):   #checking if rectange 2 is greater
   print("The Rectangle 2 has greater area")
else:                               #checking if they both are same
   print("Both has Equal Areas")

CODE3:

i 3 4 5 6 7 8. 9 10 11 num of books=int(input(Enter Number of books you purchased this month:)); #Taking number of books as

OUTPUT3:

jeswaanth@jeswaanth:-/Desktop$ python3 books.py Enter Number of books you purchased this month:10 You have Earned 60 points j

Raw_Code3:

num_of_books=int(input("Enter NUmber of books you purchased this month:"))
                           #Taking number of books as input
if(num_of_books==0):
   print("You have Earned 0 points")
elif(num_of_books==2):       #checking Required Conditions
   print("You have Earned 5 points")
elif(num_of_books==4):
   print("You have Earned 15 points")
elif(num_of_books==6):
   print("You have Earned 30 points")
elif(num_of_books>=8):
   print("You have Earned 60 points")

****Comment me in the Comment box for any Queries******

Add a comment
Know the answer?
Add Answer to:
Directions: Complete all the three programming assignments below. Please be sure to follow the programming rubric...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using C++ COLOR MIXER- The color red, yellow, and blue are primary colors because they cannot...

    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...

  • Python problem: 1. The colors red, blue, and yellow are known as the primary colors because...

    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: 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. Create a text file with the names of two colors in it. Write a program...

  • Python 11. Book Club Points Serendipity Booksellers has a book club that awards points to its...

    Python 11. Book Club Points Serendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows: If a customer purchases 0 books, he or she earns 0 points If a customer purchases 2 books, he or she earns 5 points. O If a customer purchases 4 books, he or she earns 15 points If a customer purchases 6 books, he or she earns 30...

  • Phython For this program you will be writing a program that will use if-else or if-elif-else...

    Phython For this program you will be writing a program that will use if-else or if-elif-else statements. Read-It-All bookstore has a book sales club where customers can earn reward points that can be used for their next purchase. If a customer purchases 0 books, he/she earns 0 points. If a customer purchases 1-3 books, he/she earns 5 points. If a customer purchases 4-6 books, he/she earns 10 points. If a customer purchases 7-8 books, he/she earns 15 points. If a...

  • Visual Studio and Visual Basic program b. Serendipity Booksellers has a book club that awards points...

    Visual Studio and Visual Basic program b. Serendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows: If a customer purchases no books, he or she earns 0 points. If a customer purchases 1 book, he or she earns 5 points. If a customer purchases 2 book, he or she earns 15 points. If a customer purchases 3 book, he or she earns...

  • Code in c++ please Q1: Software Sales A software company sells a package that retails for...

    Code in c++ please Q1: Software Sales A software company sells a package that retails for $99. Quantity discounts are given according to the following table: QuantityDiscount 10-19 20-49 50-99 100 or more 20% 30% 40% 50% : Write a program that asks for the number of units sold and computes the total cost of the purchase. Input validation: Make sure the number of units is greater than 0. Q2: Book Club Points Community Booksellers has a book club that...

  • Write an interactive C++ program that asks a user to input the color code of a...

    Write an interactive C++ program that asks a user to input the color code of a resistor and determines its value and tolerance Tell the user how to input the color rings “Instructions” Tell the user to input the colors one after the other After the program receives the information it will display the resistance and tolerance Output an error message if the user enters an invalid color code (no garbage values should be displayed), and ask for another input...

  • Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu:...

    Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu: Enter Circle Enter Rectangle Remove Shape Draw Shapes Exit Circles – User inputs position, radius, and color. The position is the CENTER of the circle Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner Colors – Allow red, yellow, blue, and green only Remove – Show the number of items in the list and let the user enter...

  • please solve the Program USING MATLAB. do not do #2. write in details for the command...

    please solve the Program USING MATLAB. do not do #2. write in details for the command lines. Make sure the program runs and also completely does what it askes please Write a Matlab program that displays on the screen checkerboard patterns comprising of two alternating_colors to be selected by the user. Your program MUST use as the checkerboard unit pattern a SQUARE INSCRIBED INSIDE A CIRCLE with unit pattern width and checkerboard dimension also to be inputted by the user....

  • GUI in java: Run the below code before doing the actionlistener: import java.awt.*; import javax.swing.*; public...

    GUI in java: Run the below code before doing the actionlistener: import java.awt.*; import javax.swing.*; public class DrawingFrame extends JFrame {    JButton loadButton, saveButton, drawButton;    JComboBox colorList, shapesList;    JTextField parametersTextField;       DrawingFrame() {        super("Drawing Application");        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        JToolBar toolbar = new JToolBar();        toolbar.setRollover(true);        toolbar.add(loadButton=new JButton("Load"));        toolbar.add(saveButton=new JButton("Save"));        toolbar.addSeparator();        toolbar.add(drawButton=new JButton("Draw"));               toolbar.addSeparator();        toolbar.addSeparator();        toolbar.add(new...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT