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