ProgrammingModerateGATE CS · Product-company placement

What is printed?

What is printed?
marks = [72, 85, 64, 85, 90]
print(marks.index(85), marks.count(85), sorted(marks)[len(marks) // 2], round(sum(marks) / len(marks), 1))
  1. A. 1 2 85 79.2
  2. B. 3 2 85 79.2
  3. C. 1 2 64 79.2
  4. D. 1 1 85 79.0

Correct answer: A. 1 2 85 79.2

index returns the first occurrence (position 1). The sorted list is [64, 72, 85, 85, 90], whose middle element is 85. The mean is 396 / 5 = 79.2.

More Python Programming questions

Exams that ask this topic