30秒学会 Python 片段 – for_each.md
title: for_each tags: list,beginner Executes the provided function once for each list element. Use a...
title: for_each tags: list,beginner Executes the provided function once for each list element. Use a...
title: have_same_contents tags: list,intermediate Returns True if two lists contain the same element...
Returns every nth element in a list. Use [nth-1::nth] to create a new list that contains every nth e...
Groups the elements of a list based on the given function. Use map() and fn to map the values of the...
Capitalizes the first letter of a string. Capitalize the first letter of the string and then add it ...
Initializes and fills a list with the specified value. Use list comprehension and range() to generat...
Returns the n minimum elements from the provided list. If n is greater than or equal to the provided...
Returns the length of a string in bytes. Use s.encode(‘utf-8’) to encode the given string and return...
Flattens a list of lists once. Use nested list comprehension to extract each value from sub-lists in...
Checks if the given number falls within the given range. Use arithmetic comparison to check if the g...