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