Built-in function: sorted(), built-in type: dict This function takes a dictionary as input, sorts the dictionary by its keys, and returns the sorted dictionary. 2024-11-30 15:02:37 Sort function 14 views
os, list, os.listdir, os.path.isfile, list comprehension This function lists all files in a specified directory. 2024-11-30 15:02:37 Function 13 views
String manipulation This function capitalizes the first letter of each word in the input sentence while keeping the rest in lowercase. 2024-11-30 15:02:37 String Handling Function 13 views
List Appending an element to the end of a list and returning the updated list. 2024-11-30 15:02:36 Function 14 views
os, zipfile This function zips two directories into two zip files and returns the names of the zipped files. 2024-11-30 15:02:36 File processing 14 views
string (str), list (list), integer (int), string padding (zfill), list slicing ([::-1]) This function uses Python's built-in string and list methods to implement a simple abacus addition. It adds two integers and returns the result. If the result exceeds 10 digits, a carry will be added to the highest digit. 2024-11-30 15:02:35 Function 15 views
os, zipfile, pathlib This function takes a list of files and compresses them into a single zip file, which is then saved in the specified output folder. 2024-11-30 15:02:35 Function 12 views
os, re, sys, time, json, math, random, string, datetime This code snippet includes a series of functions written using Python's built-in libraries, each serving a specific purpose such as generating random strings, checking for leap years, extracting email addresses, formatting the current time, calculating the geometric mean, reading file content, appending to a file, filtering even numbers, and getting system information. 2024-11-30 15:02:35 Code snippet 15 views
random, string, math, os, sys, time The function first generates a random string of a specified length, then gets the current timestamp, checks if the specified file path exists, and finally returns the sum of the length of the string and the timestamp (if the file exists) or -1 (if the file does not exist). 2024-11-30 15:02:34 Function 13 views
Built-in functions, list comprehensions, dictionary comprehensions, sets Define a function that takes three arguments and returns a dictionary and a set. The keys of the dictionary are the indices of the arguments, and the values are twice the value of the arguments. The set contains the keys of the dictionary. 2024-11-30 15:02:34 Function 14 views