Level 1 : What are negative indexes in Python?


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

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