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