Level 1 : What will be the output of the following Python code?


class tester:
    def __init__(self, id):
        self.id = str(id)
        id="224"
 
>>>temp = tester(12)
>>>print(temp.id)

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