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