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