python type casting

though not necessary to declare the type of variable, but it can be casted to a specific type. example below

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

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *