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