Level 1 : What will this output?


lst = [[1, 2], [3, 4]]
result = [sum(x) for x in lst]
print(result)

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