def my_func(data): for i in range(2, len(data) + 2, 2): temp = data[i - 2:i] in_str = temp[0] num = int(temp[1]) print(in_str[:num]) data = [] while True: try: data.append(input()) except (KeyboardInterrupt, EOFError): break my_func(data)
def my_func(data): for i in range(2, len(data) + 2, 2): temp = data[i - 2:i] in_str = temp[0] num = int(temp[1]) print(in_str[:num]) data = [] while True: try: data.append(input()) except (KeyboardInterrupt, EOFError): break my_func(data)