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