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:...
User Python to solve; show all code: A user will enter in data for a basketball...
User Python to solve; show all code: A user will enter in data for a basketball team. For each player on the team the user will enter The player’s last name The average number of point the player scored last season The number of games the player is projected to play in this year Write a program that will prompt the user for the player data described above. The user does not know how many players are on the team...
Use Python to solve, show all code Write a program that sums a sequence of integers...
Use Python to solve, show all code Write a program that sums a sequence of integers from a starting integer to and ending integer. The sequence is generated by skipping a value (e.g. 1,3,5,… or 2,6,10,14…). Prompt the user for a) a starting value greater than 0. Validate the value is greater than 0. b) the ending value. c) the value to skip Print out the sum of the numbers for the sequence. If the starting value is 2, the...
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).
Use Python to solve: show all code: 2) For the last assignment you had to write...
Use Python to solve: show all code: 2) For the last assignment you had to write a program that calculated and displayed the end of year balances in a savings account if $1,000 is put in the account at 6% interest for five years. The program output looked like this: Balance after year 1 is $ 1060.0 Balance after year 2 is $ 1123.6 Balance after year 3 is $ 1191.02 Balance after year 4 is $ 1262.48 Balance after...
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 PROBLEM: Goal: Design and implement a Python program to solve the following problem. Scientists measure...
PYTHON PROBLEM: Goal: Design and implement a Python program to solve the following problem. Scientists measure an object’s mass in kilograms and weight in newtons. If you know the amount of mass of an object in kilograms, you can calculate its weight in newtons with the following formula: [Note: Use or test any random numbers to check whether the weight is heavy, can be lifted or light] ????h? = ???? × 9.8 Write a program that asks the user to...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT