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