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