Level 10 : What is the content of the variable a after the slice operation?


tup = (1,2,3,4,5)
a=tup[1:4:2]
print(a)

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