Back to marketplace

Python Data Science Tool Box -1

No description yet. This curated deck is ready for daily study.

Total cards: 7•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (7)

#1
Front (Question)

Good to Remember : Tuples

Back (Answer)

Note that the return statement return x, y has the same result as return (x, y): the former actually packs x and y into a tuple under the hood!

#2
Front (Question)

How would you write a lambda function add_bangs that adds three exclamation points ‘!!!’ to the end of a string a? How would you call add_bangs with the argument ‘hello’?

Back (Answer)

The lambda function definition is: add_bangs = (lambda a: a + ‘!!!’), and the function call is: add_bangs(‘hello’).

#3
Front (Question)

nums = [2, 4, 6, 8, 10] result = map(lambda a: a ** 2, nums) What does this piece of lambda code do?

Back (Answer)

You can see here that a lambda function, which raises a value a to the power of 2, is passed to map() alongside a list of numbers, nums. The map object that results from the call to map() is stored in result.

#4
Front (Question)

Whar does the map() do?

Back (Answer)

map() applies a function over an object, such as a list.

#5
Front (Question)

What does the filter () do?

Back (Answer)

The function filter() offers a way to filter out elements from a list that don’t satisfy certain criteria.

#6
Front (Question)

What are the 2 ways of raising an exception?

Back (Answer)

try : except: and using raise

#7
Front (Question)

Back (Answer)