diff --git a/Area_of_a_Circle.py b/Area_of_a_Circle.py index 4b51892..61ac5dc 100644 --- a/Area_of_a_Circle.py +++ b/Area_of_a_Circle.py @@ -1,11 +1,11 @@ # Taking diameter from user -diameter = float(input("Enter the diameter of circle : ")) +diameter = float(input("Enter the diameter of circle: ")) # Taking diameter measure unit from user -unit = input("Enter the measure unit of diameter (e.g. in, cm) : ") +unit = input("Enter the measure unit of diameter (e.g. in, cm): ") # Finding area of a circle using ( A = 1/4 * /\ * D*D ) formula area = ((1 / 4) * (22 / 7) * (diameter * diameter)) # Printing the area -print("Area of circle is : ",area,unit+"2") +print("Area of circle is: ",area,unit+"2") 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/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

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