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 | 1736+ Python FAQs | Share
loops | print | operators | list-mutation | async | function-argument | stack | update | string-iteration | input | max-min | class-and-inheritance | data-structure | operator-overloading | parameter | random | __init_subclass__ | return-statement | raise | generators | file-handling | higher-order-function | decorator | goto-function | module | escape-operator | binary-operation | global-variable | file_handling | match | iterable | floating-point-precision | string-method | mathematical-function | list-method | touples | while-else-loop | multiple-inheritance | map-function | tuple-unpacking | input-function | multithreading | context-manager | generator | loop-control | static-method | mysql | odd-number | collections | python_version | syntax-error | built-in-function | while-and-for-loop | docstring | class | matrix | classes | python-django | bitwise-operator | for | sum-function | exception-handling | boolean | join | data-type | bitwise | typeerror | pep | gil | regular-expression | filter | asyncio-module | pandas | functions | indentation | debugging | compute | object-attribute | class-and-object | copy | comparison | sum() | sys | head-and-tail | fabs-function | set-operation | global-keyword | error | exception-handling | lists | precedence | virtual-environment | precedence-and-associativity | syntax-error | control-flow | matrix-list-comprehension | namespace | append | counter-function | immutable-data-type | installation | design-principle | int | command-line-parsing | python-repl | objects | type_conversion | data-structure | overflow | split | rollback | destructor | logical-operation | sorted | lambdas | virtual-environment | identifier | arithmetic-operation | import-method | operator-and | threading | sorting | variable | memory | statement | math | expand-tab | immutability | with-statement | round | type-conversion | generators-in-python | global-variable | python | syntaxerror | boolean-and-non-boolean | operator-or | magic-method | benefit | lambda-function | list | conditional-statement | operator | implementation | zfill-function | multiprocessing | logical-operator | datatype | complex-number | __future__ | package-management | expression | counter | comment | string-formatting | pickling-&-unpickling | function | name-mangling | data-type | filter-function | access-modifier | assert | method | dictionary | control-flow | slicing | binary | min-max-function | encapsulation | decimal | set | logical-operator | conversion | feature | error-handling | deep-copy | loop | postfix | turtle | oops | dicts | list-comprehension | operand | center | call | python-history | data_structure | tuple | sys-module | mathematics | bitwise-operator | dictionaries | zip-function | constructor | choice | assignment-operator | attribute | library | scientific-notation | global | string-slicing | round-function | list-comprehension | string | keyword | control-statement | __all__-attribute | complex | array | string-method | exception | built-in-function | slice | numeric | shallow-copy | range | min-function | data-structures | list-operation | random-function | lambda | id-function | iterator | math-copysign | file | else-statement | zip | indexing | datetime | namedtuple | condition | class-and-instance-variable | comprehension | string-slicing | nested-loop | yield | list-slicing | identity-operator | list-vs-tuple | conditional-statement | identity-operator | syntax | format | function-and-scope | list-join | type-conversion | collection | numpy | factorial-function | string-formatting | input-function | mutable | software-design | def | exponentiation | recurssion | integer | methods | list-indexing | python-module | string-concatenation | print-statement | arithmetic-expression | descriptors | regex | version | memory-management | inheritance | default-mutable-argument | encoding | enumerate() | interpreter | application | staticmethod | swapping | polymorphism | while-loop | frozenset | heap-memory | oop | invalid-list | built-in | basic | functional-programming | pseudocode | recursion | version-check | mapping-function | operations | asyncio | file-handling | init | inherit | string-manipulation | formal-and-actual-parameter | matplotlib | thread ...