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