How to cast a value to a variable in python

In python normally we don't need to specify the data type,if we want to assign a specific data type to a variable we can do so by using the following 

codr: x = str(3) # x will be '3' 
y = int(3) # y will be 3
 z = float(3) # z will be 3.0

Admin

A Software Engineer, Social Media Marketing Expert, writer,

Post a Comment

Previous Post Next Post