Level 1 : What will be the output of the following code snippet?


a = [1, 2, 3, 4, 5]
sum = 0
for ele in a:
   sum += ele 
print(sum)

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