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