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