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