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