-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuestion 97.py
41 lines (31 loc) · 874 Bytes
/
Question 97.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# You are given an integer, N. Your task is to print an alphabet rangoli of size N.
# (Rangoli is a form of Indian folk art based on creation of patterns.)
# Different sizes of alphabet rangoli are shown below:
# #size 3
# ----c----
# --c-b-c--
# c-b-a-b-c
# --c-b-c--
# ----c----
# size 5
# --------e--------
# ------e-d-e------
# ----e-d-c-d-e----
# --e-d-c-b-c-d-e--
# e-d-c-b-a-b-c-d-e
# --e-d-c-b-c-d-e--
# ----e-d-c-d-e----
# ------e-d-e------
# --------e--------
# MY SOLUTION:
def rangoli_func(n):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
letters = alphabet[0:n]
rangoli= []
for i in range(n):
rangoli.append('-'.join(letters[::-1]))
rangoli.append('-'.join(letters[1:]))
print('-'.join(rangoli))
rangoli_func(3)
#part one done, need to get the other lines and replicate it
#once replicated the job is to simplify