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