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