Level 5 : What will be the output of the following Python code?


class A():
    def disp(self):
        print("A disp()")
class B(A):
    pass
obj = B()
obj.disp()

Author: HareramG | Tags: oops | 1859+ Python FAQs | Share
binary | class-and-inheritance | object-attribute | attribute | collection | array | benefit | application | tuple-methods | string-slicing | command-line-parsing | basic | data-type-conversions | string-methods | conversion | bitwise-operator | set-operation | control-flow | debugging | comprehension | list-slicing | max-min | integers | print | python-repl | test-discovery | sys | heap-memory | string-formatting | print-statement | dictionary-methods | control-flow | thread-safe-data-structures-(queue.queue) | managing-directories-with-os-and-shutil | python-module | string-method | method-overloading | list-comprehension | random-function | using-os-and-pathlib-modules | __init_subclass__ | class | built-in-modules | datatype | scientific-notation | literal-characters-and-special-characters | type-conversion | control-statement | difference-between-threads-and-processes | booleans | built-in | deep-copy | lambdas | global-variable | postfix | logical-operation | package-management | function-argument | numpy | python-history | method | operator-or | quantifiers-(*,-+,-?,-{}) | sorting | else-statement | writing:-write(),-writelines() | expand-tab | loop-control | asyncio | regex | compute | floating-point-precision | return-statement | round | lambda | filter | anchors-(^,-$) | integer | intering | regular-expression | slicing | arithmetic-expression | sorting-and-ranking | raise | multiple-except-blocks | magic-method | feature | while-else-loop | append | sum() | datetime | overriding-methods | while-loop | logical-operator | function-and-scope | assignment-operator | numeric | mathematical-function | immutability | formal-and-actual-parameter | constructor | input-function | def | format | slice | else | tuple-unpacking | sorted | recurssion | overflow | using-else-and-finally | matrix-list-comprehension | list-join | yield | joining-and-merging-dataframes | using-map()-for-transformations | directory-operations | pickling--unpickling | encapsulation | set | data-structures-in-python | call | higher-order-function | python_version | boolean-masking | loop-control-statements | operator-and | default-arguments | exception-handling | introduction-to-threads | list | why-use-multiprocessing-over-threading?-(gil) | indexing:-loc-vs-iloc | string | precedence-and-associativity | indexing | type_conversion | counter-function | identifier | comment | arithmetic-operation | classes | split | escape-operator | odd-number | typeerror | tuples | filter-function | class-decorators | pseudocode | generators-in-python | class-and-instance-variable | round-function | random | choice | mapping-function | conditional-statement | lambda-function | iterable | decimal | single-inheritance | file | lambda-functions | membership-operators-(in,-not-in) | iterator | conditional-statements | indentation | comparison | conditional-statement | list-comprehensions | statement | inherit | using-lists-as-stacks | data-structure | docstring | oops | head-and-tail | match | reading-and-writing-files | binary-operation | functional-programming | context-manager | assert | string-method | bitwise | datetime.date,-datetime.time,-datetime.datetime | identity-operator | functional-programming | built-in-function | keyword | functions | static-method | introduction-to-python | min-max-function | rollback | min-function | arbitrary-arguments-(*args,-**kwargs) | installation | dataframe-and-series-objects | operations | list-method | pass | __future__ | generators | precedence | reading-and-writing-large-files-efficiently | python | operator-overloading | python-syntax-and-structure | list-mutation | methods | nested-loop | list-methods-and-slicing | id-function | exponentiation | sys-module | memory-management | objects | list-operation | matplotlib | class-and-object | using-yield-in-functions | goto-function | handling-missing-values-(fillna,-dropna) | sets | interpreter | syntax-error | zip-function | using-assertions-(assertequal,-assertraises) | zip | pandas | input | complex | loops | collections | floats | python-django | init | filtering-and-indexing | formatting-with-strftime | exception-handling | built-in-function | defining-functions | touples | lists | stack | dictionaries | string-manipulation | while-and-for-loop | string-slicing | creating-custom-modules | encoding | destructor | condition | recursion | while-loops | version-check | complex-number | thread-synchronization | advanced-file-operations | global-variable | raise-statement | global-keyword | file-handling | multiprocessing | operator | reading:-read(),-readline(),-readlines() | syntax | using-join()-and-is_alive()-methods | dictionary | boolean | asyncio-module | data-type | data-structure | data-type | type-conversion | implementation | frozenset | loop | expression | bitwise-operator | __all__-attribute | opening-files-(open()) | working-with-file-paths | data_structure | operators | threading | exception | software-design | error | center | pep | syntax-error | python-operators | list-vs-tuple | input-function | list-indexing | range | logical-operator | design-principle | update | copy | file_handling | tuple | multiple-inheritance | oop | version | aggregating-data-with-functools.reduce() | parsing-with-strptime | data-types | file-handling | data-structures | access-modifier | unit-testing | namespace | walking-through-directories-using-os.walk() | gil | type-conversion-and-casting | creating-and-starting-threads | multithreading | parameter | decorator | variable | operand | identity-operator | invalid-list | generator | time-series-with-pandas | polymorphism | fabs-function | matrix | mathematics | regular-expressions | int | assignment-operators | thread | working-with-dates-and-times | for | enumerate() | turtle | function | logical-operators | using-the-threading-module | error-handling | error-handling | strings | string-iteration | with-statement | async | mutable | dicts | working-with-binary-files-(rb,-wb) | dictionary-comprehensions | name-mangling | virtual-environment | namedtuple | factorial-function | map-function | join | staticmethod | descriptors | syntaxerror | string-formatting | boolean-and-non-boolean | list,-set,-and-dictionary-comprehensions | sum-function | module | import-method | virtual-environment | immutable-data-type | zfill-function | math | default-mutable-argument | key-value-pairs | identity-operators-(is,-is-not) | iterators | inheritance | working-with-temporary-files-using-tempfile | math-copysign | list-comprehension | introduction-to-multiprocessing | library | global | counter | shallow-copy | memory | swapping | mysql | multiple-inheritance | string-concatenation ...