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