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