Hey If you are beginner and want to learn a python then you are on right path. Learn basic as well as advanced programming in Python.

Search

Use of Class in Python.(Python program for explaining use of Class )


PYHTON PROGRAM




#Program of using Class and object in python

class cal:

a=int(input("Enter a="))

b=int(input("Enter b="))

obj=cal()

print("\n")

print("Addition:",obj.a+obj.b)

print("Substraction:",obj.a-obj.b)

print("Multiplication:",obj.a*obj.b)

print("Division:",obj.a//obj.b)

print("Remainder:",obj.a%obj.b)

print("Square of a:",obj.a*obj.a)

print("Square of b:",obj.b*obj.b)





*** Input && Output ***








No comments:

Post a Comment

let me know which type examples you want to comment me.