assert statement is a debugging breakpoint is inserted into a program that is convenient way.
assert 3 == 3 assert 1 == True assert (4 == 4) print('-----------') assert (3 == 4) ''' AssertionError throws an exception, the back does not perform ''' print('-----------')
isinstance Function Description:
When we define a class, we actually define a data type. We define data types and comes with Python data types, such as str, list, dict is no different:
to determine whether a variable is a type can be used isinstance () to determine:
class Student(): def __init__(self, name, score): self.name = name self.score = score a = '10' b = 3 c = [1, 2, 3] d = (1, 2, 3) f = Student('Eden', 99.9)
print(isinstance(a, str)) # True
print(isinstance(b, int)) # True
print(isinstance(c, list)) # True
print(isinstance(d, tuple)) # True
print(isinstance(f, Student)) # True