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