pattern

Solutions on MaxInterview for pattern by the best coders in the world

showing results for - "pattern"
Iain
25 Apr 2019
1num = int(input("Enter the Number: "))
2k = 1
3for i in range(0, num):
4    for j in range(0, i+1):
5        print(k, end="")
6        k = k+1
7    print()
8
9# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student) 
Addie
17 Mar 2020
1num = int(input("Enter the Number: "))
2
3for i in range(1, num+1):
4    for j in range(0, num):
5        print(i, end="")
6    print()
7
8# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student) 
Ariadna
21 Feb 2016
1
2        python
3        
4            
5        
6     import re
7text, pattern = input(), input()
8m= list(re.finditer("(?=(%s))"%pattern,text))
9if not m:
10    print((-1,-1))
11for i in m:
12    print((i.start(1),i.end(1)-1))
Ana
07 Jan 2020
1rows = int(input("Enter the Number of rows: "))
2cols = int(input("Enter the Number of cols: "))
3
4for i in range(0, rows):
5    for j in range(0, cols):
6        if i == 0 or j == 0 or j == cols-1 or i == rows - 1:
7            print("3", end="")
8        else:
9            print(i, end="")
10    print()
11
12# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student) 
Roberta
29 Jul 2016
1rows = int(input("Enter rows:"))
2cols = int(input("Enter Cols:"))
3
4for i in range(0, rows):
5    for j in range(0, cols):
6        if i==0 or j==0 or i == rows-1 or j == cols-1:
7            print("*", end="")
8        else:
9            print(" ", end="")
10    print()
11
12# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student) 
similar questions
queries leading to this page
pattern