diff --git a/FencedMatrix.py b/FencedMatrix.py index 6088ad8..48f9b68 100644 --- a/FencedMatrix.py +++ b/FencedMatrix.py @@ -3,27 +3,30 @@ # list comprehension, deep and shallow copy methods in Python. # The project can be performed on Jupyter Notebook or Google Colab. -#take input without using library ast +# take input without using library ast in_str=input() -#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 + +# 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 in_str=in_str.split(',') + # number of rows : m m=int(in_str[0]) + # number of columns : n n=int(in_str[1]) -#make a list with n zeroes +# make a list with n zeroes final=[0]*n -#make a matrix of m such lists using list comprehensions +# make a matrix of m such lists using list comprehensions final=[list(final) for i in range(m)] for i in range(m): for j in range(n): if i==0 or j==0 or i==m-1 or j==n-1: - final[i][j]=1 #changing the list without any copy method + final[i][j]=1 # changing the list without any copy method -#print in the fashion as shown in Sample output +# print in the fashion as shown in Sample output for i in final: print(i) diff --git a/Find_area _of_triangle.py b/Find_area _of_triangle.py index cbe6329..f0b2a0a 100644 --- a/Find_area _of_triangle.py +++ b/Find_area _of_triangle.py @@ -8,6 +8,5 @@ # calculating area of the triangle area = (s*(s-a)*(s-b)*(s-c)) ** 0.5 - print('The area of the triangle is:', area) diff --git a/String_reversal_2.py b/String_reversal_2.py index 7eda448..8167a95 100644 --- a/String_reversal_2.py +++ b/String_reversal_2.py @@ -1,5 +1,4 @@ # String reversal using recursion - def reverse(strr): if len(strr) == 0: return strr