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