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