+ 2

Pattern qustion

1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1

9th Oct 2017, 5:07 PM
Prerna Goyal
Prerna Goyal - avatar
6 Respostas
+ 7
print(' 1\n 1 2 1\n 1 2 3 2 1\n1 2 3 4 3 2 1')
9th Oct 2017, 6:38 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
a = 5 #Input tab = 10 #tab in pattern for r in range(0, a): b = [] print ' '*tab, for c in range(0,2*r+1): if c <= r: b.append(c+1) else: b.append(2*r+1-c) print ''.join(map(str,b)) tab -= 1 this will give the output as 1 121 12321 1234321 123454321
9th Oct 2017, 9:18 PM
Nikhith S
Nikhith S - avatar
+ 4
@Kuba you can just print it as a multiline comment. It won't matter
10th Oct 2017, 7:38 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
For i in range(5): print((5-i)*" ",end="") print(list(range(1,i))+list(range(i,0,-1)),sep=" ")
10th Oct 2017, 7:39 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
@vengat the pattern produced from your code produces list of elements ! Not the pattern described by the submitter
10th Oct 2017, 7:44 PM
Nikhith S
Nikhith S - avatar
0
You need a code for it?
9th Oct 2017, 5:20 PM
Freezemage
Freezemage - avatar