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 | 1736+ Python FAQs | Share
staticmethod | mathematics | round-function | file | logical-operator | enumerate() | list-operation | comprehension | inheritance | while-else-loop | feature | mutable | polymorphism | data_structure | type-conversion | goto-function | memory | version-check | function-argument | shallow-copy | installation | control-statement | format | inherit | functions | zip | random-function | mysql | return-statement | pseudocode | string | parameter | built-in-function | bitwise-operator | math | for | call | keyword | descriptors | condition | math-copysign | syntax-error | arithmetic-operation | immutable-data-type | join | random | swapping | input-function | sys | benefit | generators-in-python | data-structure | conditional-statement | binary-operation | operations | operator | slicing | library | counter-function | datetime | string-slicing | operator-and | methods | filter | string-slicing | application | multiple-inheritance | else-statement | overflow | raise | list-comprehension | yield | syntax | odd-number | precedence-and-associativity | import-method | print | binary | dicts | basic | center | integer | generator | list | syntaxerror | sorting | matplotlib | asyncio-module | input | list-indexing | python_version | range | choice | max-min | complex | head-and-tail | docstring | destructor | comparison | function-and-scope | pandas | magic-method | factorial-function | async | virtual-environment | sum() | file-handling | string-iteration | decorator | boolean | oops | string-concatenation | regex | collections | default-mutable-argument | python-repl | print-statement | package-management | boolean-and-non-boolean | operator-or | tuple | constructor | class-and-object | datatype | indexing | function | round | command-line-parsing | split | logical-operator | error-handling | tuple-unpacking | control-flow | min-function | thread | global-variable | statement | software-design | exception-handling | conditional-statement | decimal | objects | expand-tab | string-method | control-flow | encapsulation | file-handling | string-formatting | touples | class-and-instance-variable | operators | int | python-django | filter-function | debugging | postfix | dictionaries | operand | loop | scientific-notation | data-type | append | class-and-inheritance | invalid-list | interpreter | list-comprehension | id-function | context-manager | version | syntax-error | loops | immutability | rollback | numeric | error | list-vs-tuple | fabs-function | list-join | mathematical-function | slice | data-structure | attribute | python-history | string-method | recurssion | identity-operator | collection | input-function | frozenset | nested-loop | pep | namespace | python | implementation | generators | set | map-function | encoding | bitwise-operator | __init_subclass__ | string-formatting | built-in | method | multithreading | lambdas | logical-operation | while-and-for-loop | module | multiprocessing | counter | asyncio | array | functional-programming | namedtuple | match | update | arithmetic-expression | class | conversion | list-mutation | assignment-operator | global-keyword | sys-module | recursion | formal-and-actual-parameter | list-method | data-type | escape-operator | virtual-environment | threading | regular-expression | with-statement | pickling-&-unpickling | min-max-function | iterable | file_handling | floating-point-precision | variable | exception | built-in-function | dictionary | identity-operator | data-structures | global | higher-order-function | deep-copy | copy | set-operation | classes | heap-memory | numpy | __future__ | matrix | gil | type_conversion | type-conversion | loop-control | lists | exception-handling | zfill-function | oop | iterator | python-module | lambda | bitwise | global-variable | assert | name-mangling | sum-function | def | sorted | init | __all__-attribute | matrix-list-comprehension | indentation | precedence | object-attribute | turtle | memory-management | stack | exponentiation | while-loop | list-slicing | expression | string-manipulation | complex-number | identifier | lambda-function | operator-overloading | mapping-function | design-principle | typeerror | static-method | access-modifier | compute | comment | zip-function ...