def print_box(width, height, filled): for i in range(height): if i == 0 or i == height - 1: print("+" + " + " * (width - 2) + "+") else: if filled: print("+" + " + " * (width - 2) + "+") else: print("+ " + " " * (width * 2 - 5) + " +") def main(): width = int(input("Enter a width: ")) height = int(input("Enter a height: ")) filled = input("Filled (y/n): ").lower() == 'y' print("Here is your box:") print_box(width, height, filled) if __name__ == "__main__": main()