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