Level 1 : What will be the output of the following Python code?


x = 'abcd'
for i in x:
    print(i)
    x.upper()

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