From b6546872d4c8c4d09381914820b38d4ab10c471d Mon Sep 17 00:00:00 2001 From: ssrop <56187250+ssrop@users.noreply.github.com> Date: Fri, 11 Oct 2019 22:39:18 +0530 Subject: [PATCH] Create Task2Problem0.py --- Competitive/Task2Problem0.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Competitive/Task2Problem0.py diff --git a/Competitive/Task2Problem0.py b/Competitive/Task2Problem0.py new file mode 100644 index 0000000..b7b8cec --- /dev/null +++ b/Competitive/Task2Problem0.py @@ -0,0 +1,31 @@ +def print_pattern(size): + width = size*4-3 + string = '' + + for i in range(1,size+1): + for j in range(0,i): + string += chr(96+size-j) + if len(string) < width : + string += '-' + for k in range(i-1,0,-1): + string += chr(97+size-k) + if len(string) < width : + string += '-' + print(string.center(width,'-')) + string = '' + + for i in range(size-1,0,-1): + string = '' + for j in range(0,i): + string += chr(96+size-j) + if len(string) < width : + string += '-' + for k in range(i-1,0,-1): + string += chr(97+size-k) + if len(string) < width : + string += '-' + print(string.center(width,'-')) + + +n = int(input()) +print_pattern(n)