def generate_example(): len = random.randint(1, 20) len2 = random.randint(1, 20) str1 = gen_utils.randomstring(len) str2 = gen_utils.randomstring(len2) return (str1, str2, str1 + str2)
def generate_example(): len = random.randint(1, 20) len2 = random.randint(1, 20) n = random.randint(1, 20) str1 = gen_utils.randomstring(len) str2 = gen_utils.randomstring(len2) if n > len2: out_str = str1 + str2[:n - 1] else: out_str = str1 + str2 return (str1, str2, n, out_str)
def generate_example(): array_len = random.randint(1, 30) len2 = random.randint(1, array_len) arr1 = list(gen_utils.randomstring(array_len)) arr2 = list(gen_utils.randomstring(len2)) len_in_array = random.randint(1, array_len) for i in range(len_in_array): character = arr2[random.randint(0, len2 - 1)] arr1[i] = character return (''.join(arr1), ''.join(arr2), len_in_array)
def generate_example(): array_len = random.randint(1, 30) len2 = random.randint(1, array_len) arr1 = gen_utils.randomstring(array_len) arr2 = gen_utils.randomstring(len2) c = 0 for char in arr2: if char in arr1: break c += 1 return (arr1, arr2, c)
def generate_example(): array_len = random.randint(1, 30) len2 = random.randint(1, 30) arr1 = gen_utils.randomstring(array_len) arr2 = gen_utils.randomstring(len2) are_equal = random.randint(0, 1) if are_equal == 1 or arr1 == arr2: res = 1 return (arr1, arr1, res) else: res = 0 return (arr1, arr2, res)
def generate_example(): array_len = random.randint(1, 30) n = random.randint(1, 30) arr1 = gen_utils.randomstring(array_len) arr2 = [0] * min((array_len + 1), n + 1) if n < array_len: outarr = arr1[:n - 1] else: outarr = arr1 return (arr1, arr2, n, outarr)
def generate_example(): array_len = random.randint(1, 30) len2 = random.randint(1, 30) arr1 = list(gen_utils.randomstring(array_len)) arr2 = list(gen_utils.randomstring(len2)) n = random.randint(1, 30) within_range_n = min(n, min(array_len, len2)) are_equal = random.randint(0, 1) if are_equal == 1 or (array_len == len2 and arr1[:within_range_n] == arr2[:within_range_n]): res = 1 for i in range(within_range_n): arr2[i] = arr1[i] if within_range_n < n: while len(arr2) > len(arr1): del arr2[-1] while len(arr1) > len(arr2): del arr1[-1] else: res = 0 return (''.join(arr1), ''.join(arr2), n, res)
def generate_example(): len = random.randint(1, 20) elem_index = random.randint(0, len - 1) string = gen_utils.randomstring(len) should_contain = random.randint(0, 1) if should_contain == 1: elem = string[elem_index] else: elem = string[0] tries = 0 while elem in string: tries += 1 elem = gen_utils.random_char() if tries == 100: should_contain = 1 break return (string, elem, should_contain)
def generate_example(): len = random.randint(1, 20) string = list(gen_utils.randomstring(len)) starting_ind_count = random.randint(0, len // 2) starting_char = string[0] replacement_char = starting_char while replacement_char == starting_char: replacement_char = gen_utils.random_char() for i in range(0, starting_ind_count): string[i] = starting_char # Make sure the next char is not the same as the # ones we are looking at. if string[starting_ind_count] == starting_char: string[starting_ind_count] = replacement_char return (''.join(string), starting_char, starting_ind_count)
def generate_example(): len = random.randint(1, 20) str1 = gen_utils.randomstring(len) return (str1, len)
def generate_example(): array_len = random.randint(1, 30) arr1 = gen_utils.randomstring(array_len) arr2 = [0] * (array_len + 1) return (arr1, arr2, arr1)