1. Create a single list that contains the following collection of data in the order provided:
[1121, "Jackie Grainger", 22.22,
1122, "Jignesh Thrakkar", 25.25,
1127, "Dion Green", 28.75, False,
24.32, 1132, "Jacob Gerber",
"Sarah Sanderson", 23.45, 1137, True,
"Brandon Heck", 1138, 25.84, True,
1152, "David Toma", 22.65,
23.75, 1157, "Charles King", False,
"Jackie Grainger", 1121, 22.22, False,
22.65, 1152, "David Toma"]
The data above represents employee information exported from an Excel spreadsheet. Whomever typed the data in originally didn't give much care to how the information was formatted, unfortunately. Each line of data has in it employee information (the whole number), the name of the employee (the string), and the employee's hourly wage (the decimal number). Some rows have extra information in them from a column in the spreadsheet that no one can remember what its purpose was.
Note that the presence of a couple of new data types in the above - "float" values (the numbers with the decimals in them) and "bool" [short for boolean] values (True and False).
2. Assume that the above information is a small sample of the company's data. Programmatically sort the information into three different lists: one for employee numbers, one for employee names, and one for employee salary information.
3.No duplicate data should make its way into the new lists.
4.For each value in the list containing hourly wage information, multiply the current value by 1.3 (since benefits are about 30% of a person's salary) and store each value in a list called total_hourly_rate. Programmatically determine the maximum value in the list and if it's over over 37.30, throw a warning message that someone's salary may be a budget concern.
5.Determine if anyone's total hourly rate is between 28.15 and 30.65. If they are, add the hourly rate a new list called underpaid_salaries.
6.For each value in the list that contains unmodified salary information, calculate a raise in dollars according to the following rules:
If the hourly rate is between 22 and 24 dollars per hour, apply a 5% raise to the current rate. If the hourly rate is between 24 and 26 dollars per hour, apply a 4% raise to the current rate. If the hourly rate is between 26 and 28 dollars per hour, apply a 3% raise to the current rate. All other salary ranges should get a standard 2% raise to the current rate.
Add each new value you calculate to a new list called company_raises.
7.Design your own complex condition with no fewer than four different truth tests in it (all conditions must be on one line, in other words). Above your condition, write out in comments the exact behavior you are implementing with Python.
Problem 1:
Create a set of six conditional tests with three evaluating to True and three evaluating to False. Work to differentiate your tests, testing different variable types, values, and equality tests; no two tests should be too similar.
Before each test, add a comment stating whether or not you expect the conditional expression to evaluate to True or False. Then, print the result of the expression. Example:
# I predict the expression below will evaluate to True
color = "blue"
print(color == "blue")
Problem 2:
Pick a number from 1 to 10 and store it as a variable. Write an if test to check whether or not the number is odd. If it is, print a message stating that the number is odd. Otherwise, nothing should happen.
Write one version of this program where the if test evaluates to True and one where it evaluates to False.
Problem 3:
Modify the program you wrote in problem 2 to use an if-else block. If the number is odd, the program will display a message that the number is odd. Otherwise, it will add one to the number and print it out.
Problem 4:
Create a list of your favorite fruits. Write an if-elif-else chain that checks the length of the list.
If the length of the list is two, print a message that you like two fruits.
If the length of the list is three, print a message that you like three fruits.
If the length of the list is four, print a message that you like four fruits.
If the length of the list is five or more, print a message that you like several fruits.
Problem 5:
Create a list of numbers from 1-55. Then pick two numbers and store them as variables. Write condition statements to check if each number is in the list of numbers. If a number is in the list, print a message stating that the number was found. If a number is not in the list, print a message stating that the number was not found.
Problem 6:
Make a list of your favorite stores and another list of stores that are currently running sales.
Loop through the list of stores and check and see if any of them are currently running a sale. If a store is running a sale, display a message that a user should take advantage of a sale at their favorite store. Otherwise, a message should be displayed that the store isn't currently running a sale. Be sure to include the name of the store in both messages.