Question

In: Computer Science

-Python- Suppose Dict = {1: ["Jack", 35, 13.00], 20:["James", 20, 8.50], 14:["Jordan", 38, 12.00], 12:["Wayne", 33,...

-Python-

Suppose Dict = {1: ["Jack", 35, 13.00], 20:["James", 20, 8.50], 14:["Jordan", 38, 12.00], 12:["Wayne", 33, 12.00]}

1. Print name and grosspay(hours * pay) of each person in a new line.

2. Print average of hours

Solutions

Expert Solution

Explanation:

Here is the code which has the Dictionary given.

In the first part, it prints the name and the gross pay of each person mentioned in the dictionary by traversing the values of the dictionary.

In the second part, all the hours are added and the persons are counted to calculate the average hours.

Code:


Dict = {1: ["Jack", 35, 13.00], 20:["James", 20, 8.50], 14:["Jordan", 38, 12.00], 12:["Wayne", 33, 12.00]}

#Part 1:

for k, v in Dict.items():
print(v[0], v[1]*v[2])


#Part 2:
avg = 0
n = 0
for k, v in Dict.items():
avg = avg + v[1]
n = n + 1

avg = avg/n

print("Average hours:", avg)

Output:

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!

PLEASE COMMENT IF YOU NEED ANY HELP!


Related Solutions

11 12 11 10 14 15 16 12 11 10 12 20 13 32 35 14...
11 12 11 10 14 15 16 12 11 10 12 20 13 32 35 14 41 12 10 11 12 12 13 16 14 17 18 19 12 13 14 10 10 14 11 10 12 14 12 13 16 14 17 19 20 15 25 15 45 45 44 41 40 14 18 19 24 20 26 36 34 30 31 50 15 12 Find the following: Mean? (1) Median (2), and Mode? Find : Q3, Q1, D7,...
Consider the data. xi 3 12 6 20 14 yi 65 35 50 15 20 The...
Consider the data. xi 3 12 6 20 14 yi 65 35 50 15 20 The estimated regression equation for these data is ŷ = 70 − 3x. (a) Compute SSE, SST, and SSR using equations SSE = Σ(yi − ŷi)2, SST = Σ(yi − y)2, and SSR = Σ(ŷi − y)2. SSE=SST=SSR= (b) Compute the coefficient of determination r2. (Round your answer to three decimal places.) r2 = Comment on the goodness of fit. (For purposes of this exercise,...
Consider the data. xi 3 12 6 20 14 yi 60 35 55 15 15 The...
Consider the data. xi 3 12 6 20 14 yi 60 35 55 15 15 The estimated regression equation for these data is ŷ = 69 − 3x. (a) : Compute SSE, SST, and SSR using equations SSE = Σ(yi − ŷi)2, SST = Σ(yi − y)2, and SSR = Σ(ŷi − y)2. SSE= SST= SSR= (b) Compute the coefficient of determination r2 (Round your answer to three decimal places.) r2 = Comment on the goodness of fit. (For purposes...
Consider the data. xi 3 12 6 20 14 yi 55 35 45 10 15 The...
Consider the data. xi 3 12 6 20 14 yi 55 35 45 10 15 The estimated regression equation for these data is ŷ = 62.25 − 2.75x. (a) Compute SSE, SST, and SSR using equations SSE = Σ(yi − ŷi)2, SST = Σ(yi − y)2, and SSR = Σ(ŷi − y)2. SSE= SST= SSR= (b) Compute the coefficient of determination r2.(Round your answer to three decimal places.) r2 = Comment on the goodness of fit. (For purposes of this...
Kevin Company issues bonds on 1/1/20. Suppose, for Kevin Company (fiscal year end of 12/31), the...
Kevin Company issues bonds on 1/1/20. Suppose, for Kevin Company (fiscal year end of 12/31), the carrying value of Kevin Company bonds at 12/31/20 and 12/31/21 are $106,461 and $105,073 respectively. Please give the journal entries to mark to market at 12/31/20 and 12/31/21 and supporting calculations in each year for the following scenarios: 1: FMV at 12/31/20 = $107,500; FMV at 12/31/21 = $106,500 2: FMV at 12/31/20 = $107,500; FMV at 12/31/21 = $106,000 3: FMV at 12/31/20...
Given two independent random samples with the following results: n1=8 x‾1=109 s1=35 n2=12 x‾2=145 s2=20 Use...
Given two independent random samples with the following results: n1=8 x‾1=109 s1=35 n2=12 x‾2=145 s2=20 Use this data to find the 98% confidence interval for the true difference between the population means. Assume that the population variances are not equal and that the two populations are normally distributed. Copy Data
For the stress data given below with the nearest error of 1: 27-17-11-24-36-13-29-22-18 23-30-12-46-17-32-48-11-18 18-32-26-24-38-24-15-13-13 18-21-27-20-16-15-37-19-19...
For the stress data given below with the nearest error of 1: 27-17-11-24-36-13-29-22-18 23-30-12-46-17-32-48-11-18 18-32-26-24-38-24-15-13-13 18-21-27-20-16-15-37-19-19 a) Construct a frequency distribution table. b) Construct the three types of statistical graphs. c) Determine the (1) Mean, (2) Median, (3) Mode, (4) Range, Variance, and (6) Standard Deviation.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT