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


print("Hello {0!r} and {0!s}".format('foo', 'bin'))

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