Built-ins & Standard Library · Question 1 · Easy

sum, len, max and min are applied to a list of three marks. What two numbers are printed?

marks = [70, 80, 90]
print(sum(marks) // len(marks), max(marks) - min(marks))
  1. 80.0 20
  2. 80 20
  3. 240 20
  4. 80 90
Answer and explanation

Answer: B. 80 20

Explanation: The sum is 240 and there are 3 marks, so 240 // 3 = 80 (floor division keeps it an int). The highest minus the lowest is 90 − 70 = 20.

Next: sorted is called with reverse=True on a list. What does the code print for the…

Practise built-ins & standard library

Try a fresh set of built-ins & standard library questions with an explanation after every answer, free and without signing up: Built-ins & Standard Library practice. Or sit a full placement mock test.

More built-ins & standard library questions

More python practice

Variables, Types & Operators · Python Strings · Lists & Tuples · Dictionaries & Sets · Conditions & Loops · Functions & Scope · Comprehensions & Generators · Classes & Objects

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge