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