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