Level 10 : What will be the output of the following Python code?


def sample(a):
    a = a + '2'
    a = a*2
    return a
sample("hello")

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