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