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


import re
s = 'abc123 xyz666 lmn-11 def77'
re.sub(r'\b([a-z]+)(\d+)', r'\2\1:', s)

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