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