Level 1 : What will be the output of the following Python code snippet?


for i in [1, 2, 3, 4][::-1]:
    print (i)

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