![]() | Variables are not declared |
![]() | Variables hold references to objects of any type
a = 3 # reference to an int object containing 3 a = 3.0 # reference to a float object containing 3.0 a = '3.' # reference to a string object containing '3.' a = ['1', 2] # reference to a list object containing # a string '1' and an integer 2 |
![]() | Test for a variable's type:
if isinstance(a, int): # int? if isinstance(a, (list, tuple)): # list or tuple? |