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