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


x = ['ab', 'cd']
for i in x:
    x.append(i.upper())
print(x)

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