Its not giving any error if i give string as input for age..as you told me?

class A:
def init(self,name,age:int):
self.name=name
self.age=age
def show(self):
print(self.age,self.name)
obj=A(“ajay”,“siddartha”)
obj.show()

and also why we have to use format methof…when we can directly print or return the output string

hey buddy , i am really sorry for this misconception , i was wrong in it too.
take a read here.
doing like def func(a:int): , its just annotation , its doesn’t mean or specify that it is of type int.
So to check the type ,
you can use assertion.
like
def func(a:int):
>>> assert type(a) == int ,message here

Here the message is something that you wan to print , if you receive an assertion error from the previous assertion check.

No able to understand this.
Can you please be more brief on it.

I hope it helped you :slightly_smiling_face:.