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


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

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