From c1b0d38c2bb226c1197b5c91c24bd5d52d733d30 Mon Sep 17 00:00:00 2001 From: Ashish Shukla <91776515+ashishshukla09@users.noreply.github.com> Date: Sun, 2 Oct 2022 10:47:17 +0530 Subject: [PATCH 1/2] Create Print_Pyramid.py --- Python/Print_Pyramid.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Python/Print_Pyramid.py diff --git a/Python/Print_Pyramid.py b/Python/Print_Pyramid.py new file mode 100644 index 00000000..eedda237 --- /dev/null +++ b/Python/Print_Pyramid.py @@ -0,0 +1,6 @@ +n = int(input("Enter the value of n: ")) + +for i in range(n): + print(" " * (n-i-1), end="") + print("*" * (2*i+1), end="") + print(" " * (n-i-1)) From f0d27163c4431f040da5aeda612d1f61182310ef Mon Sep 17 00:00:00 2001 From: Ashish Shukla <91776515+ashishshukla09@users.noreply.github.com> Date: Sun, 2 Oct 2022 10:52:36 +0530 Subject: [PATCH 2/2] Create Calculator_usingOOPS.py --- Python/Calculator_usingOOPS.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Python/Calculator_usingOOPS.py diff --git a/Python/Calculator_usingOOPS.py b/Python/Calculator_usingOOPS.py new file mode 100644 index 00000000..6c84ad95 --- /dev/null +++ b/Python/Calculator_usingOOPS.py @@ -0,0 +1,18 @@ +class Calculator: + def __init__(self ,num): + self.number = num + + def square(self): + print(f"The square of {self.number} is {self.number **2}") + + def squareRoot(self): + print(f"The squareroot of {self.number} is {self.number **(1/2)}") + + def cube(self): + print(f"The cube of {self.number} is {self.number **3}") + +a= Calculator(3) +b= Calculator(16) +a.square() +b.squareRoot() +a.cube()