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