Level 5 : what is the output of the following code?


class Test:
    def __init__(self):
        self.x = 0
class Derived_Test(Test):
    def __init__(self):
        self.y = 1
def main():
    b = Derived_Test()
    print(b.x,b.y)
main()

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