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