Level 9 : How does the list neg_numbers relate to the original list numbers?


numbers = [1, 2, 3, 4, 5]
neg_numbers = [-x for x in numbers]
print(neg_numbers)

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