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


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

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