Level 1 : What is the output of the below code?


fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
newlist = [x for x in fruits if "a" in x]

print(newlist)

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