def print_text_in_box(text): width = len(text) + 2 print('+' + '-' * (width - 2) + '+') print('|' + text + '|') print('+' + '-' * (width - 2) + '+') user_text = input("Enter some text: ") print_text_in_box(user_text)