ise 135 HW3 Solution Key Spring 2023

docx

School

University Of Georgia *

*We aren’t endorsed by this school

Course

135

Subject

Industrial Engineering

Date

Jan 9, 2024

Type

docx

Pages

6

Uploaded by ChancellorEnergyCaterpillar26

Report
ISE 135 COMPUTER BASED MODELING 2023 Spring HOMEWORK 3 SOLUTION KEY Question 1: A common misconception is that if you receive a 10% pay raise and later a 10% pay cut, your salary will be unchanged. Request a salary as input and then display the salary after receiving a 10% pay raise followed by a 10% pay cut. The program also should display the percentage change in salary. An output example: (PS:This was your optional PS question, but nobody was able to solve this because of the time.) SOLUTION: Question 2: Write a pay-raise program that requests a person’s first name, last name, and current annual salary, (5 times – in other words request 5 different people’s info) and then displays these people’s salaries for next year in a table. Assume each person will receive a 5% raise in each year. An Output Example:
SOLUTION Question 3: Write a program that requests a three-part name and then displays the middle name by using lists. An Output Example: Code:
Question 4: Ask user to enter a list containing a mix of integers and float values. Find the sum, min and max of values within the list. Delete the minimum value in the original list to create a new list, but make sure the original list remains unchanged. An output example: SOLUTION: Question 5: Your user company holds “revenue and expense” data for each quarter (3-month-old period). Your task is writing a code to calculate the user company’s profit. First, you should ask the data from the user and store the data in a list. Your list should have 4 inner lists. Here is an example: dataList = [[revenue_1, expense_1], [revenue_2, expense_2], [revenue_3, expense_3], [revenue_4, expense_] ] where revenue_n = the revenue in the n th quarter expense_n = the expense in the n th quarter profit = (sum of all revenues) – (sum of all expenses) While calculating the sums, USE NESTED LISTS. Print your data in a nested list format, then display your output (profit) by using a descriptive sentence. An example is given:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Hint: This data list’s elements are lists! Make sure you are creating lists for each quarter, and then add them into the outer list. SOLUTION:
OPTIONAL: Do not submit anything for this question. Identify the errors. a) Index out of range. The list does not have an item of index 3. b) The statement word[1] = 'p' is not valid since strings are immutable. c) The join method only can be applied to a list consisting entirely of strings. Question 1: Assume that the list states contains the names of the fifty U.S. states in the order they joined the union, and determine the output displayed by the lines of code. states = ["Delaware", "Pennsylvania", "New Jersey", "Georgia", "Connecticut", "Massachusetts", . . ., "Utah", "Oklahoma", "New Mexico", "Arizona", "Alaska", "Hawaii"] a) print(states[0], states[-50]) Delaware Delaware b) states.append("Puerto Rico") print(states[50]) Puerto Rico c) states.append( ["Puerto Rico" ]) print(states[50]) ['Puerto Rico']
d) print(states[-4:-1]) ['New Mexico', 'Arizona', 'Alaska']
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help