โ† All HACKERRANK Flashcard Decks

Built-in Functions and Lambdas Flashcards

7 cards from real HACKERRANK practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Built-in Functions and Lambdas flashcards as text
  1. What does `all([True, True, True])` return?

    Answer: True

    all() returns True only when every element in the iterable is truthy.

  2. What is the result of `round(3.14159, 2)`?

    Answer: 3.14

    round() with ndigits=2 rounds the float to 2 decimal places, giving 3.14.

  3. What does `enumerate(['a', 'b', 'c'], start=1)` produce?

    Answer: (1,'a'), (2,'b'), (3,'c')

    enumerate with start=1 pairs each element with an index beginning at 1 instead of 0.

  4. What is the output of `list(zip([1,2,3], ['a','b','c']))`?

    Answer: [(1,'a'), (2,'b'), (3,'c')]

    zip pairs elements from each iterable at the same index into tuples.

  5. Which built-in function converts a string to an integer?

    Answer: int()

    int() converts a string (or other numeric type) to an integer.

  6. What does `sum([1, 2, 3], 10)` return?

    Answer: 16

    sum() accepts an optional start argument; it adds 1+2+3+10 = 16.

  7. What does `len({'a': 1, 'b': 2, 'c': 3})` return?

    Answer: 3

    len() on a dictionary returns the number of key-value pairs.