Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3.13 LAB: List work (Salaries) The template program for this lab is set to read input: A series of state names in a list variable

3.13 LAB: List work (Salaries)

The template program for this lab is set to read input:

  • A series of state names in a list variable called states. Example: ['California', 'New York', 'Washington', 'Virginia']
  • A series of floats in a list variable called salaries. These floats in the salaries list represent the average Python programmer salaries by state in 2019 (source Gooroo). Example: [122135, 121443, 116366, 115309]

Note: the two lists order elements in the same order; this means that, for each index i, the element at position i in the salaries list is the average Python programmer salary in the state named at the index i in the states list.

(1) Add code to ask the user to input the average salary of a Python programmer for Kentucky -- a float. Then add the state name and the salary to the respective list. Note: if new data is not added correctly to the lists, that will impact the next sections of the program. (Submit for 2 points)

Enter average salary for Kentucky: # prompt 150000 # user input 

(2) Add code to find and output the highest average salary and the state that has the highest average salary. (Submit for 3 points, so 5 points total)

Enter average salary for Kentucky: # prompt 150000 # user input Highest average salary is 150000.0, in the state of Kentucky. 

(3) Add code to find and output the median salary. That is the value that is in the middlemost salary in the data set. You will need to sort the salaries list, by using the sort() method for lists. Then, find the middle index (that can be approximate; for a list of 9 elements, the middle index is 4; for a list of 10 elements, the middle index is 5). Finally, obtain the element situated in the middle of the sorted salaries list; that is the median that you are searching for. (Submit for 3 points, so 8 points total).

Enter average salary for Kentucky: # prompt 150000 # user input Highest average salary is 150000.0, in the state of Kentucky. The median salary is 121443.0.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions