Level 1 : What is the output of the following code?


data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(data[1 : : 2])

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