From 78c51c98db22b04e192a0945747e5887439f8e79 Mon Sep 17 00:00:00 2001 From: vivek sharma <45270024+vvksharrma@users.noreply.github.com> Date: Mon, 5 Oct 2020 19:01:45 +0530 Subject: [PATCH] Create doormat design hackerrank Mr. Vincent works in a doormat manufacturing company. One day, he designed a new doormat with the following specifications: Mat size must be X. ( is an odd natural number and is times .) --- doormat design hackerrank | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 doormat design hackerrank diff --git a/doormat design hackerrank b/doormat design hackerrank new file mode 100644 index 0000000..2b7abdd --- /dev/null +++ b/doormat design hackerrank @@ -0,0 +1,19 @@ +def doormatDesign(rows, columns): + width = columns + + for i in range (0, int (rows / 2)): + pattern = "|#|" * ((2 * i) + 1) + print (pattern.center (width, '~')) + + print ("HactoberFest2020".center (width, '-')) + + i = int (rows / 2) + while i > 0: + pattern = "|#|" * ((2 * i) - 1) + print (pattern.center (width, '~')) + i = i-1 + return + +rows = 7 +columns = rows * 3 +doormatDesign(rows, columns)