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