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