Level 6 : What will be the output of this program?


arr = [3 , 2 , 5 , 6 , 0 , 7, 9]  
add1 = 0  
add2 = 0  
for elem in arr:  
    if (elem % 1 == 0):  
        add1 = add1 + elem  
        continue  
    if (elem % 3 == 0):  
        add2 = add2 + elem  
print(add1 , end=" ")  
print(add2)

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