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