Level 9 : What will be the output of the following Python code snippet?


for i in [1, 2, 3, 4][::-1]:
    print(i, end=' ')

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