Quiz Catalog

Catalog of quizzes

row_data = ["False", 1076, [], True, 13 - 5, ("Vancouver", "Helsinki", "Montreal"), "trust", {56.22, "12"}]
row_data.sort(reverse=True)

print(row_data)
TypeError: '<' not supported between 'int' and 'str'
  • list/operation/sort

lst = [15 + 6, 24 // 3, True == False, 12 - 3 - 3, 7 + 5 // 4]
lst.sort(key=lambda x: x > 10)

print(set(lst))
{8, False, 21, 6}
  • list/operation/sort
  • build-in/set

lst = ["Jake", "Mike", "Brien", "Tim", "George", "Heisenberg"]
lst.sort(key=lambda x: len(x), reverse=True)

print(lst)
['Heisenberg', 'Brien', 'George', 'Jake', 'Mike', 'Tim']
  • list/operation/sort

lst = [(25, 48, 254), {17, 32, 54.54}, [125, 91], [4.03], (77.78,), {.0299}, {41.7, 33, 49, 55}]
lst.sort(key=lambda x: max(x))

print(lst)
[{0.0299}, [4.03], {32, 17, 54.54}, {41.7, 33, 55, 49}, (77.78,), [125, 91], (25, 48, 254)]
  • list/operation/sort