Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CPT200 – Week-2 Interactive Assignment – General Feedback When you’re a professional coder, the priority is to complete tasks as efficiently and fast as possible. In practice, you are encouraged to...

1 answer below »
CPT200 – Week-2 Interactive Assignment – General Feedback
When you’re a professional coder, the priority is to complete tasks as efficiently and fast as possible. In practice, you are
encouraged to visit consulting sites like Stack Overflow and GitHub in order to look at how someone solved a problem, and integrate
it into your own code. GitHub for instance, is commonly used to host open-source software projects (https:
github.com/). It has been
eported that as of June 2018, GitHub has over 28 million users and 57 million repositories. In other words, sharing and repurposing
existing code are increasingly becoming standard practices in the software development field. However, to demonstrate originality
with your code in the academic setting, you are encouraged to improve the code that you found online. Please read the following
article on how to code without plagiarizing:
https:
www.turnitin.com
log/plagiarism-and-programming-how-to-code-without-plagiarizing-2
This week interactive assignment was intentionally created similar to the question that can be found in the following Stack
Overflow link: https:
stackoverflow.com/questions/ XXXXXXXXXX/mixing-colors-program. As mentioned before, you are encouraged to
use existing solutions, but you are also required to pay attention to the technical specification that describes the internal
implementation of your software. The following code will demonstrate to you how to employ the list data structures and how to avoid
plagiarizing by changing the code that can be found in the above Stack Overflow link. After you review the code, please make sure to
eproduce
etype it, and then test it to ensure the developed functionality meets the following requirements:
1- For primary colors, users can only enter one of the following (red, blue, yellow)
2- Users can’t enter the same primary color twice
3- The code is not case sensitive so you can enter either UPPER or lower case letters (RED or red)
Once you have tested the following program, identify the advantages and disadvantages of using list data structures, take a screen shot of the
completed functionality (including the input and the output) and save it in a Word document, along with the script. Please make sure to submit your
document before the end of Monday.
https:
en.wikipedia.org/wiki/Open-source
https:
github.com
https:
en.wikipedia.org/wiki/Repository_(version_control)
https:
www.turnitin.com
log/plagiarism-and-programming-how-to-code-without-plagiarizing-2
https:
stackoverflow.com/questions/ XXXXXXXXXX/mixing-colors-program
Note: The following solution is one of many possible solutions for the CPT200 Week2 Interactive Assignment.

References:
TurnItIn XXXXXXXXXXPlagiarism and Programming: How to Code Without Plagiarizing. Retrieved from
http:
turnitin.com/en_us
esources
log/2660-plagiarism-and-programming-how-to-code-without-plagiarizing-2
NYTimes XXXXXXXXXXMicrosoft Buys GitHub for $7.5 Billion, Moving to Grow in Coding’s New Era. Retrieved from
https:
www.nytimes.com/2018/06/04/technology/microsoft-github-cloud-computing.html
StackOverflow XXXXXXXXXXMixing colors program. Retrieved from https:
stackoverflow.com/questions/ XXXXXXXXXX/mixing-colors-program
http:
turnitin.com/en_us
esources
log/2660-plagiarism-and-programming-how-to-code-without-plagiarizing-2
https:
www.nytimes.com/2018/06/04/technology/microsoft-github-cloud-computing.html
https:
stackoverflow.com/questions/ XXXXXXXXXX/mixing-colors-program

Week 2 Interactive Assignment Color Mixe
CPT200: Fundamentals of Programming Languages
Dr. Amjad Alkilani
March 11, 2021
Red and blue = purple
Red and yellow = orange
Blue and yellow = green
Part 1 User input:
print ("Color Mixer")
primarycolor1 = input( "Enter primary color 1: ")
primarycolor2 = input( "Enter primary color 2: ")
print()
Part 2: Color Output
if ( primarycolor1 == "red" and primarycolor2 == "blue" ) or \
( primarycolor1 == "blue" and primarycolor2 == "red" ):
print( primarycolor1 + " mix with " + primarycolor2 + " is purple " )
elif ( primarycolor1 == "red" and primarycolor2 == "yellow" ) or \
( primarycolor1 == "yellow" and primarycolor2 == "red" ):
print( primarycolor1 + " mix with " + primarycolor2 + " is orange " )
elif ( primarycolor1 == "blue" and primarycolor2 == "yellow" ) or \
( primarycolor1 == "yellow" and primarycolor2 == "blue" ):
print( primarycolor1 + " mix with " + primarycolor2 + " is green " )
else:
print( "One color must atleast match, " + primarycolor1 + " and " + \
XXXXXXXXXXprimarycolor2 + " is not a primarycolor given" )

Process in developing the program:
1. First start by programming a prompt that ask the user to enter the name of two colors. Start by asking the user for two colors utilizing the input function. Once the user types in something it will need to be stored in a variable. The variables for this program is the primarycolor1; primarycolor2. Color is stored in the variable.
a. primarycolor1 = input( "Enter primary color 1: ")
. primarycolor2 = input( "Enter primary color 2: ")
2. The we will create an “If” statement or a code to handle of the users input of the two colors because the colors chosen can be picked in different orders i.e... red + blue=purple or blue + red=purple. The statement must be two sided because of this which is why we use ==. The “==+ command is used to compare both side of the statement. If you used “=” it only compares the left side to the right. Making the script invalid if the user right the colors in reverse order.
a. if ( primarycolor1 == "red" and primarycolor2 == "blue" ) or \
. ( primarycolor1 == "blue" and primarycolor2 == "red" ):
3. We need to create a “elif” statement that covers if the color is something other than red and blue. The script is also
oken to accommodate the 80 characters or less in the python program which is the reason for the (\). We do the elif statement two times to cover all the colors listed to be used.
a. elif ( primarycolor1 == "red" and primarycolor2 == "yellow" ) or \
( primarycolor1 == "yellow" and primarycolor2 == "red" ):
print( primarycolor1 + " mix with " + primarycolor2 + " is orange " )
. elif ( primarycolor1 == "blue" and primarycolor2 == "yellow" ) or \
( primarycolor1 == "yellow" and primarycolor2 == "blue" ):
print( primarycolor1 + " mix with " + primarycolor2 + " is green " )
4. If the users types any other combinations of colors than the ones listed than there should be an e
or. An “else” statement is used and the “print” command is used to display the e
or message to the user..
a. else:
print( "One color must atleast match, " + primarycolor1 + " and " + \
primarycolor2 + " is not a primarycolor given" )
Answered 1 days After Mar 14, 2021

Solution

Neha answered on Mar 14 2021
158 Votes
77668 - color mixer python/77668 - color mixer.py
primaryColorlst = ['red','blue','yellow']
secondaryColorlst = ['purple','orange','green']
while(True):
print ("Color Mixer")
print('------------------------------------------------')
print('Primary color are: ')
print('1. Red')
print('2. Blue')
print('3. Yellow')
print('------------------------------------------------')
primarycolor1 = input( "Enter primary color 1: ")
primarycolor1 = primarycolor1.lower()
if (primarycolor1 not in primaryColorlst):
print('Invalid primary color')
input()
continue
primarycolor2 = input( "Enter primary color 2: ")
primarycolor2 = primarycolor2.lower()
if (primarycolor2 not in primaryColorlst):
print('Invalid primary color')
continue

elif (primarycolor1 == primarycolor2):
print('You have already selected this primary color please select another')
continue
print('------------------------------------------------')
if ( primarycolor1 == primaryColorlst[0] and primarycolor2 == primaryColorlst[1] ) or \
( primarycolor1 == primaryColorlst[1] and primarycolor2 == primaryColorlst[0] ):
print( primarycolor1 + " mix with " + primarycolor2 + " is ", secondaryColorlst[0] )
elif ( primarycolor1 == primaryColorlst[0] and primarycolor2 == primaryColorlst[2] ) or \
( primarycolor1 == primaryColorlst[2] and primarycolor2 == primaryColorlst[0] ):
print( primarycolor1 + " mix with " + primarycolor2 + " is...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here