►
Run
class A: x = 10 y = 20 name = 'z' obj = A result = hasattr(obj, name) print(f'Does the object {obj} has attribute named "{name}"? {result}')
Output