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