Question

In: Computer Science

Solve with Python: The following is the color code of the jackets of employees for a...

Solve with Python:

The following is the color code of the jackets of employees for a companies annual conference. The Color is determined by the Employee category and the state in which they work.

Employee Category

Executive (1)

Director(2)

Manager(3)

Worker(4)

State

Jacket Color

State

Jacket Color

State

Jacket Color

State

Jacket Color

NY, NJ, PA

Blue

NY, NJ, PA

Purple

NY, NJ, PA

Red

NY, NJ, PA

Black

TX, LA, FL

White

TX, LA, FL

Green

TX, LA, FL

Maroon

TX, LA, FL

Grey

Get the employee category (1/2/3/4) and the state from the user and display what color code he/she has to follow for the conference.

Solutions

Expert Solution

employeeCategory=int(input('Enter employee category(1/2/3/4): '))
state=input('Enter state(NY/NZ/PA/TX/LA/FL): ')
state1=['NY','NJ','PA']

color=''
if employeeCategory==1:
    if state.upper() in state1:
        color='Blue'
    else:
        color='White'
elif employeeCategory==2:
    if state.upper() in state1:
        color='Purple'
    else:
        color='Green'
elif employeeCategory==3:
    if state.upper() in state1:
        color='Red'
    else:
        color='Maroon'
else:
    if state.upper() in state1:
        color='Black'
    else:
        color='Grey'

print('Color code to follow:',color)


Related Solutions

I just wrote Python code to solve this problem: Write a generator that will return a...
I just wrote Python code to solve this problem: Write a generator that will return a sequence of month names. Thus gen = next_month('October') creates a generator that generates the strings 'November', 'December', 'January' and so on. If the caller supplies an illegal month name, your function should raise a ValueError exception with text explaining the problem. Here is my code: month_names = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] def next_month(name: str) -> str:...
Write a python script to solve the 4-queens problem using. The code should allow for random...
Write a python script to solve the 4-queens problem using. The code should allow for random starting, and for placed starting. "The 4-Queens Problem[1] consists in placing four queens on a 4 x 4 chessboard so that no two queens can capture each other. That is, no two queens are allowed to be placed on the same row, the same column or the same diagonal." Display the iterations until the final solution Hill Climbing (your choice of variant)
Use Python to solve each problem. Answers should be written in full sentences. Define a code...
Use Python to solve each problem. Answers should be written in full sentences. Define a code that will give users the option to do one of the following. Convert an angle from radians to degrees, Convert an angle from degrees to radians, Return the sine, cosine, or tangent of a given angle (need to know if angle is given in degrees or radians).
IN PYTHON Write a program to do the following: Solve the a set of equations as...
IN PYTHON Write a program to do the following: Solve the a set of equations as mentioned in "Zybook 5.20 LAB: Brute force equation solver". Instead of the arithmetic operators use your own function defined in a module named calc. You must provide two files (calc.py, brute_force_solver.py) :- 1) calc.py:- Add function named 'add' instead of using operator '+' [10pts] Add function named 'difference' instead of using operator '-' [10pts] Add function named 'product' instead of using operator '*' [10pts]...
check the following code: is the requirements correct ? if not solve it . All the...
check the following code: is the requirements correct ? if not solve it . All the styles must be in a document style sheet. YOU ARE NOT ALLOWED TO USE THE type ATTRIBUTE ON THE LIST, you must use CSS to apply the style. <!DOCTYPE html> <html> <head> <title> car list</title> <style> body {background-color: powderblue;} h1   {color: blue;} p    {color: red;} </style> </head> <body> <style type="text/css"> ol{list-style-type:upper-roman;} ol ol{list-style-type:upper-alpha;} ol ol ol{list-style-type:decimal;} li.compact{background-color:pink;} li.midsize{background-color:blue;} li.sports{background- color:red;} ol.compact{background-color:pink;} ol.midsize{background-color:blue;} ol.sports{background-color:red;} </style>...
can you please convert this python code into java? Python code is as shown below: #...
can you please convert this python code into java? Python code is as shown below: # recursive function def row_puzzle_rec(row, pos, visited):    # if the element at the current position is 0 we have reached our goal    if row[pos] == 0:        possible = True    else:        # make a copy of the visited array        visited = visited[:]        # if the element at the current position has been already visited then...
Python Explain Code #Python program class TreeNode:
Python Explain Code   #Python program class TreeNode:    def __init__(self, key):        self.key = key        self.left = None        self.right = Nonedef findMaxDifference(root, diff=float('-inf')):    if root is None:        return float('inf'), diff    leftVal, diff = findMaxDifference(root.left, diff)    rightVal, diff = findMaxDifference(root.right, diff)    currentDiff = root.key - min(leftVal, rightVal)    diff = max(diff, currentDiff)     return min(min(leftVal, rightVal), root.key), diff root = TreeNode(6)root.left = TreeNode(3)root.right = TreeNode(8)root.right.left = TreeNode(2)root.right.right = TreeNode(4)root.right.left.left = TreeNode(1)root.right.left.right = TreeNode(7)print(findMaxDifference(root)[1])
Write code in Python that does the following : An anagram is when the order of...
Write code in Python that does the following : An anagram is when the order of a word can be changed to create a new word (evil, live, and vile for example). Using the dictionary provided, find all of the anagram groups. Which words contain the most anagrams? How large is this group? Here is another example: Alert, alter, and later have 3 in their group. Use the provided dict.txt as your word list, solution must also finish in less...
In Mendel's pea plants, the genes that code for flower color, seed color and seed shape...
In Mendel's pea plants, the genes that code for flower color, seed color and seed shape are on 3 different chromosomes. For flower color, purple is dominant over white, yellow seeds are dominant over green and round seeds are dominant over wrinkled seeds. If you crossed two parents who were heterozygous for all 3 genes, how many purple flowered, round and yellow seeded plants would you expect in the offspring generation? correct answer is 27/64 please show work thank you
What is the python code to solve this type of nonlinear equation in jupyter notebook 16cos2x+16sin2x-40.1cosx+2.3sinx+16.223=0...
What is the python code to solve this type of nonlinear equation in jupyter notebook 16cos2x+16sin2x-40.1cosx+2.3sinx+16.223=0 Please show the code clearly.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT