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