• Sep 9, 2023 •AustinLeath
0 likes • 24 views
print("test")
• Nov 19, 2022 •CodeCatch
1 like • 3 views
def hex_to_rgb(hex): return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4)) hex_to_rgb('FFA501') # (255, 165, 1)
• Sep 20, 2025 •cntt.dsc-f4b6
1 like • 2 views
print(123)
• May 31, 2023 •CodeCatch
0 likes • 3 views
import itertools def compute_permutations(string): # Generate all permutations of the string permutations = itertools.permutations(string) # Convert each permutation tuple to a string permutations = [''.join(permutation) for permutation in permutations] return permutations # Prompt the user for a string string = input("Enter a string: ") # Compute permutations permutations = compute_permutations(string) # Display the permutations print("Permutations:") for permutation in permutations: print(permutation)
• Jun 1, 2023 •CodeCatch
filename = "data.txt" data = "Hello, World!" with open(filename, "a") as file: file.write(data)
• Nov 18, 2022 •AustinLeath
0 likes • 1 view
# @return a list of strings, [s1, s2] def letterCombinations(self, digits): if '' == digits: return [] kvmaps = { '2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz' } return reduce(lambda acc, digit: [x + y for x in acc for y in kvmaps[digit]], digits, [''])