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