Same reference to an integer object, a string and a list : Variable Declaration « Language Basics « Python






Same reference to an integer object, a string and a list

Same reference to an integer object, a string and a list

x = 0            # x bound to an integer object
print x

x = "Hello"      # now it's a string
print x

x = [1, 2, 3]    # and now it's a list
print x
           
       








Related examples in the same category

1.A value can be assigned to several variables simultaneouslyA value can be assigned to several variables simultaneously