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