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