Level 1 : what is the output of the following code.


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

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