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