Level 1 : What are negative indexes in Python?


list=[1,2,3,4]
print(list[-1])

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