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