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)
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]...
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])
this is a python code that i need to covert to C++ code...is this possible? if...
this is a python code that i need to covert to C++ code...is this possible? if so, can you please convert this pythin code to C++? def main(): endProgram = 'no' print while endProgram == 'no': print # declare variables notGreenCost = [0] * 12 goneGreenCost = [0] * 12 savings = [0] * 12 months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] getNotGreen(notGreenCost, months) getGoneGreen(goneGreenCost, months) energySaved(notGreenCost, goneGreenCost, savings) displayInfo(notGreenCost, goneGreenCost, savings, months)...
I would like the following code in PYTHON please, there was a previous submission of this...
I would like the following code in PYTHON please, there was a previous submission of this question but I am trying to have the file save as a text file and not a json. Any help would be greatly appreciated. Create an application that does the following: The user will enter product codes and product numbers from the keyboard as strings. The product code must consist of four capital letters. The product number can only consist of numeric characters, but...
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
solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
Write a complete and syntactically correct Python program to solve the following problem: You are the...
Write a complete and syntactically correct Python program to solve the following problem: You are the payroll manager for SoftwarePirates Inc. You have been charged with writing a package that calculates the monthly paycheck for the salespeople. Salespeople at SoftwarePirates get paid a base salary of $2000 per month. Beyond the base salary, each salesperson earns commission on the following scale: Sales Commission Rate Bonus <$10000 0% 0 $10000 – $100,000 2% 0 $100,001 - $500,000 15% $1000 $500,001 -...
Solve the following question by using python language In range of 1-10000 if the numbers are...
Solve the following question by using python language In range of 1-10000 if the numbers are divisible by n1 increase count by 1 , if the number is divisible by n2 increase count by 2, and if the number are divisible by n3 increase the count by 3 if none of the above conditions match for the number, increase count by the number. n1=10 +17 n2=50 +21 n3=100 +9
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT