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