Level 1 : What is the output of the below python code?


num=20
sum=0
while num!=0:
     rem = num%10
     sqr = rem*rem
     sum = sum+sqr
     num = int(num/10)
print("\nSum of squares of digits of given number is: %s"%(sum))

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