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