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