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