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