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