Level 1 : What are negative indexes in Python?


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

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