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