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