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