Level 1 : What is the output of the following code?


a = ['xy','yz']
for i in a:
     a.append(i.upper())
print(a)

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