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