Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4dffe64

Browse files
Update FencedMatrix.py
1 parent 675a287 commit 4dffe64

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

‎FencedMatrix.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,30 @@
33
# list comprehension, deep and shallow copy methods in Python.
44
# The project can be performed on Jupyter Notebook or Google Colab.
55

6-
#take input without using library ast
6+
#take input without using library ast
77
in_str=input()
8-
#as the input is in the form --> m,n where m is number of rows and n is number of columns, so we will split it using comma as separator
8+
9+
# as the input is in the form --> m,n where m is number of rows and n is number of columns, so we will split it using comma as separator
910
in_str=in_str.split(',')
11+
1012
# number of rows : m
1113
m=int(in_str[0])
14+
1215
# number of columns : n
1316
n=int(in_str[1])
1417

15-
#make a list with n zeroes
18+
#make a list with n zeroes
1619
final=[0]*n
1720

18-
#make a matrix of m such lists using list comprehensions
21+
#make a matrix of m such lists using list comprehensions
1922
final=[list(final) for i in range(m)]
2023

2124
for i in range(m):
2225
for j in range(n):
2326
if i==0 or j==0 or i==m-1 or j==n-1:
24-
final[i][j]=1 #changing the list without any copy method
27+
final[i][j]=1 #changing the list without any copy method
2528

26-
#print in the fashion as shown in Sample output
29+
#print in the fashion as shown in Sample output
2730
for i in final:
2831
print(i)
2932

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /