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() 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))