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