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