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