Level 1 : What will the following code output?


t = (1, 2, 3)
print(id(t))
t += (4,)
print(id(t))

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