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


names = ["srinu", "krishna", "Mani", "sagar", "chandra"]
newlist = [x for x in names if "a" in x]
print(newlist)

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