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 | 1736+ Python FAQs | Share
list-vs-tuple | print | list-slicing | immutable-data-type | for | polymorphism | __init_subclass__ | class | implementation | typeerror | context-manager | condition | nested-loop | string-formatting | mutable | string-method | numpy | multithreading | pandas | class-and-inheritance | file | software-design | set | methods | recurssion | init | iterator | split | indentation | tuple | complex-number | while-else-loop | exception-handling | expression | memory | def | operator | generators | function-and-scope | update | variable | min-max-function | decimal | mathematics | overflow | oops | sys | global-keyword | comparison | syntaxerror | encoding | statement | join | enumerate() | expand-tab | regex | precedence | functions | sorting | type-conversion | control-flow | boolean-and-non-boolean | destructor | access-modifier | choice | counter-function | yield | descriptors | int | inherit | list-operation | fabs-function | method | control-flow | python | data-type | data-structure | comment | generators-in-python | version | inheritance | formal-and-actual-parameter | matplotlib | functional-programming | heap-memory | string-iteration | bitwise-operator | operator-or | staticmethod | collections | class-and-object | logical-operator | logical-operation | operator-overloading | gil | regular-expression | data-type | function | __all__-attribute | list-indexing | pseudocode | filter-function | data_structure | built-in-function | tuple-unpacking | matrix-list-comprehension | min-function | list | zfill-function | exception-handling | syntax-error | python-django | return-statement | string-method | sum() | while-and-for-loop | stack | default-mutable-argument | sum-function | list-comprehension | multiple-inheritance | copy | __future__ | type_conversion | factorial-function | compute | threading | package-management | class-and-instance-variable | python-history | boolean | set-operation | keyword | arithmetic-operation | oop | constructor | string | library | decorator | loops | shallow-copy | error | exponentiation | conditional-statement | namedtuple | higher-order-function | type-conversion | application | match | round | python-module | function-argument | print-statement | id-function | basic | numeric | filter | lambda | sys-module | benefit | magic-method | asyncio-module | pickling-&-unpickling | indexing | built-in-function | mysql | loop | center | file_handling | dictionary | command-line-parsing | bitwise-operator | docstring | with-statement | object-attribute | postfix | operator-and | append | conversion | invalid-list | global-variable | encapsulation | logical-operator | complex | objects | syntax | range | slice | datetime | feature | identity-operator | raise | thread | list-method | mathematical-function | parameter | round-function | list-comprehension | identity-operator | classes | design-principle | async | debugging | random | string-slicing | lists | collection | version-check | slicing | control-statement | lambdas | scientific-notation | data-structures | virtual-environment | comprehension | rollback | string-manipulation | multiprocessing | input | import-method | binary-operation | map-function | list-mutation | lambda-function | string-slicing | file-handling | arithmetic-expression | string-concatenation | bitwise | datatype | file-handling | global | operations | sorted | exception | dicts | turtle | odd-number | static-method | binary | while-loop | math-copysign | list-join | format | python-repl | loop-control | mapping-function | zip | iterable | string-formatting | input-function | swapping | precedence-and-associativity | frozenset | namespace | generator | counter | floating-point-precision | pep | array | deep-copy | built-in | memory-management | call | integer | recursion | operators | error-handling | asyncio | data-structure | operand | input-function | global-variable | interpreter | assert | head-and-tail | dictionaries | assignment-operator | attribute | else-statement | installation | goto-function | immutability | identifier | max-min | zip-function | module | random-function | name-mangling | touples | syntax-error | matrix | escape-operator | python_version | virtual-environment | conditional-statement | math ...