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