satya

Sunday, January 3, 2021

Program 30

                                                                        Program 30

Write a Python class to implement pow(x, n).

class Pow1:

    def poe(self,x,n):

        k=x**n

        print("pow({},{})={}".format(x,n,k))


p=Pow1()

x=int(input("Enter the X value:"))

n=int(input("Enter the Y value:"))

p.poe(x,n)



OUTPUT:

===== RESTART: C:/Users/crrcse/Desktop/29.py =======
Enter the X value:3
Enter the Y value:4
pow(3,4)=81
>>> 

No comments:

Post a Comment

Program 30

                                                                         Program 30 Write a Python class to implement pow(x, n). class Pow1:...