Level 9 : What is the output of the following code?


class Teacher:  
    def __init__(self, id, age):  
        self.id = id  
        self.age = age  
        print(self.age)  
tear = Teacher("John", 20)  
tear.age = 30  
print(tear.age)

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