Level 9 : What will be the output of the following Python code?


l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))

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