Question

In: Computer Science

Suppose grades = [9, 7, 7, 10, 3, 9, 6, 6, 2] Write in Python An...

  1. Suppose grades = [9, 7, 7, 10, 3, 9, 6, 6, 2]

Write in Python

  1. An expression that evaluates to the number of 7 grades
  2. A statement that changes the last grade to 4
  3. An expression that evaluates to the maximum grade
  4. A statement that sorts the list grades
  5. An expression that evaluates to the average grade

Solutions

Expert Solution

Let us suppose the name of the list is "grades"

grades= [9,7,7,10,3,9,6,6,2]

a). grades.count(7)

b). grades[len(grades)-1]=4

c). max(grades)

d). grades.sort() # For ascending order

grades.sort(reverse=True) # For descending order

e). sum(grades) / len(grades)

Sample Output:

NOTE : The original output varies for questions d and e when you execute c,d and e separately without executing b.

Because, in b the original list is manipulated.


Related Solutions

x 2 8 5 9 4 3 9 6 7 8 y 3 6 5 7...
x 2 8 5 9 4 3 9 6 7 8 y 3 6 5 7 9 7 4 6 9 9 -5.48x + 0.17 5.48x + 0.17 -0.17x + 5.48 0.17x + 5.48
3 6 4 8 1 10 2 9 11 12 15 22 3 6 7 5...
3 6 4 8 1 10 2 9 11 12 15 22 3 6 7 5 8 1 12 14 Each column represents a different treatment given to sick rats. Each cell is a different rat. Use statistical analysis and use post hoc testing using contrasts to find the best treatment. Treatment 1: vitamins Treatment 2: prescription pills Treatment 3: brain surgery Treatment 4: shock therapy Treatment 5: dietary changes
3, 7, 8, 5, 6, 4, 9, 10, 7, 8, 6, 5 Using the previous question...
3, 7, 8, 5, 6, 4, 9, 10, 7, 8, 6, 5 Using the previous question 's scores, If three points were added to every score in this distribution, what would be the new mean? If three points were added to every score in this distribution, what would be the new standard deviation. Remember, you have already calculated population standard deviation in a previous problem. This problem requires two answers.
1) Given the list of integers 1, -2, 3, -6, 7, -8, 9, 10, -11, indexed...
1) Given the list of integers 1, -2, 3, -6, 7, -8, 9, 10, -11, indexed from 1 to 9, the left-to-right linear scan algorithm (O(n) algorithm) will set as candidate start positions for a maximum contiguous sequence the elements at the index positions: (a) 1,3,4,6 (b) 1,3,4,6,9 (c) 1,3,5,7 (d) none of the above 2)The Fibonacci sequence 1,1,2,3, ... can be generated iteratively by starting with the first two (0th and 1st) and generating every subsequent one by adding...
Consider the matrix list x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. Write...
Consider the matrix list x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. Write a list comprehension to extract the first column of the matrix [1, 4, 7]. Write another list comprehension to create a vector of twice the square of the middle column.
Write a python program. Grades are values between zero and 10 (both zero and 10 included),...
Write a python program. Grades are values between zero and 10 (both zero and 10 included), and are always rounded to the nearest half point. To translate grades to the American style, 8.5 to 10 become an “A,” 7.5 and 8 become a “B,” 6.5 and 7 become a “C,” 5.5 and 6 become a “D,” and other grades become an “F.” Implement this translation, whereby you ask the user for a grade, and then give the American translation. If...
Match No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14...
Match No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Player A 8 42 56 68 91 123 12 46 57 137 5 80 14 10 19 Player B 38 44 46 59 57 61 48 42 51 39 58 41 55 45 68 1. For the given data set representing the runs scored by two players in last 15 matches, conduct the following analysis: i. Which average you will use to summarize...
Year 1 2 3 4 5 6 7 8 9 10 A 1 1.01 1.0201 1.0303...
Year 1 2 3 4 5 6 7 8 9 10 A 1 1.01 1.0201 1.0303 1.0406 1.0510 1.0615 1.0721 1.0829 12.0305 B 1 .9900 .9801 .9703 .9606 .9510 .9415 .9321 .9227 10.0487 Assume a purchase price of $10 Million for both properties. (a) What is the expected total return (IRR) on a 10-year investment in each property? Use a financial calculator or equation solver for this. (b) If the 10% cap rate represents a fair market value for each...
Periods ​1% ​2% ​3% ​4% ​5% ​6% ​7% ​8% ​9% ​10% ​12% ​14% ​15% ​16% ​18%...
Periods ​1% ​2% ​3% ​4% ​5% ​6% ​7% ​8% ​9% ​10% ​12% ​14% ​15% ​16% ​18% ​20% 1 0.990 0.980 0.971 0.962 0.952 0.943 0.935 0.926 0.917 0.909 0.893 0.877 0.870 0.862 0.847 0.833 2 0.980 0.961 0.943 0.925 0.907 0.890 0.873 0.857 0.842 0.826 0.797 0.769 0.756 0.743 0.718 0.694 3 0.971 0.942 0.915 0.889 0.864 0.840 0.816 0.794 0.772 0.751 0.712 0.675 0.658 0.641 0.609 0.579 4 0.961 0.924 0.888 0.855 0.823 0.792 0.763 0.735 0.708 0.683 0.636...
Period   0 1 2 3 4 5 6 7 8 9 10 11 PBP NPV IRR...
Period   0 1 2 3 4 5 6 7 8 9 10 11 PBP NPV IRR Project A $                       (1,000,000) $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 400,000 Project B $                       (1,000,000) $ 500,000 $ 500,000 $ 500,000 Project C $                             (80,000) $      1,040 $      9,456 $    11,405 $    18,567 $    47,453 $      6,394 $    45,727 $    51,933 $    85,625 Project D $                           (400,000) $      4,161...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT