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