30秒学会 Python 片段 – Number to binary
Returns the binary representation of the given number. Use bin() to convert a given decimal number i...
Returns the binary representation of the given number. Use bin() to convert a given decimal number i...
Returns the n maximum elements from the provided list. Use sorted() to sort the list. Use slice nota...
Returns the index of the element with the minimum value in a list. Use min() and list.index() to obt...
Initializes a list containing the numbers in the specified range where start and end are inclusive w...
Maps the values of a list to a dictionary using a function, where the key-value pairs consist of the...
Converts a given string into a list of words. Use re.findall() with the supplied pattern to find all...
Returns the index of the element with the maximum value in a list. Use max() and list.index() to get...
Reverses a number. Use str() to convert the number to a string, slice notation to reverse it and str...
Sorts the given dictionary by key. Use dict.items() to get a list of tuple pairs from d and sort it ...
Calculates the date of n days ago from today. Use datetime.date.today() to get the current day. Use ...