Level 10 : Choose the correct option for the below.


a=[1,2,3,4]
b=[sum(a[0:x+1]) for x in range(0,len(a))]
print(b)

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