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