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 | 1736+ Python FAQs | Share
factorial-function | complex-number | __init_subclass__ | function | python-history | round-function | input-function | destructor | functional-programming | binary-operation | list-vs-tuple | indentation | zip | built-in-function | comprehension | list-comprehension | generators | fabs-function | dictionary | touples | pandas | floating-point-precision | package-management | print | async | range | functions | matrix-list-comprehension | exponentiation | operators | datatype | expand-tab | def | postfix | list-comprehension | built-in-function | heap-memory | filter | input-function | compute | loop | built-in | class-and-instance-variable | attribute | staticmethod | static-method | class | pep | syntax-error | data_structure | precedence-and-associativity | mathematics | lambdas | deep-copy | encoding | descriptors | yield | formal-and-actual-parameter | virtual-environment | data-structure | global-variable | operator-or | regular-expression | int | python-django | string-iteration | comparison | global-variable | arithmetic-operation | generator | collection | numeric | class-and-inheritance | control-flow | turtle | tuple | while-and-for-loop | numpy | immutable-data-type | head-and-tail | conversion | mathematical-function | precedence | keyword | binary | list | random | magic-method | lists | module | dictionaries | call | random-function | object-attribute | global | loop-control | class-and-object | shallow-copy | encapsulation | assignment-operator | overflow | sys | string-method | indexing | enumerate() | map-function | bitwise-operator | slicing | namespace | update | bitwise | assert | version-check | lambda | docstring | stack | list-operation | raise | type-conversion | multithreading | benefit | feature | string-slicing | identity-operator | lambda-function | complex | access-modifier | command-line-parsing | copy | string-formatting | choice | string-manipulation | variable | conditional-statement | odd-number | list-join | python-module | input | implementation | virtual-environment | boolean-and-non-boolean | inheritance | round | exception-handling | array | oop | match | data-structure | set-operation | counter-function | slice | max-min | data-structures | init | matplotlib | split | asyncio-module | logical-operation | exception-handling | string-method | bitwise-operator | default-mutable-argument | multiple-inheritance | arithmetic-expression | append | for | dicts | center | else-statement | datetime | control-flow | name-mangling | mutable | constructor | id-function | min-function | matrix | recursion | math | design-principle | sys-module | rollback | operator-and | math-copysign | function-argument | __all__-attribute | python | polymorphism | zip-function | counter | file-handling | escape-operator | boolean | software-design | parameter | interpreter | sum-function | syntax | string-concatenation | print-statement | import-method | filter-function | error | sum() | debugging | type-conversion | goto-function | context-manager | collections | with-statement | tuple-unpacking | scientific-notation | operator | memory | list-slicing | return-statement | python_version | comment | immutability | multiprocessing | file-handling | frozenset | loops | __future__ | swapping | classes | memory-management | typeerror | join | integer | thread | while-else-loop | error-handling | generators-in-python | condition | global-keyword | version | regex | syntax-error | threading | invalid-list | decorator | higher-order-function | asyncio | set | statement | list-mutation | data-type | methods | pseudocode | python-repl | string-formatting | function-and-scope | type_conversion | identifier | gil | mysql | min-max-function | recurssion | inherit | operations | expression | list-method | format | library | file_handling | zfill-function | list-indexing | pickling-&-unpickling | installation | syntaxerror | string-slicing | nested-loop | mapping-function | method | basic | operand | sorting | while-loop | conditional-statement | iterable | logical-operator | application | exception | logical-operator | operator-overloading | sorted | string | namedtuple | data-type | identity-operator | oops | decimal | file | iterator | control-statement | objects ...