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