Level 1 : What will be the output of the below python code?


def truncate(n, decimals=0):
    multiplier = 10 ** decimals
    return int(n * multiplier) / multiplier

truncate(1.625, 2)

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