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