Level 9 : How does the output display the odd or even nature of the numbers in the list?


list=[1,2,3,4,5,6,7]
num = [x&1 for x in list]
print(num)

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