adplus-dvertising
frame-decoration

Question

What is the output of the code shown below?
import re
s = 'abc123 xyz666 lmn-11 def77'
re.sub(r'\b([a-z]+)(\d+)', r'\2\1:', s)

a.

‘123abc: 666xyz: lmn-11 77def:’

b.

‘77def: lmn-11: 666xyz: 123abc’

c.

‘abc123:’, ‘xyz666:’, ‘lmn-11:’, ‘def77:’

d.

‘abc123: xyz666: lmn-11: def77’

Posted under Python

Answer: (a).‘123abc: 666xyz: lmn-11 77def:’

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the code shown below?

Similar Questions

Discover Related MCQs

Q. Which of the codes shown below results in a match?

Q. Which of the following special characters represents a comment (that is, the contents of the parenthesis are simply ignores)?

Q. Which of the following statements are true ?

Q. What happens if no arguments are passed to the seek function?

Q. How do you change the file position to an offset value from the start?

Q. How do you delete a file?

Q. How do you rename a file?

Q. How do you get the current position within the file?

Q. How do you close a file object (fp)?

Q. Which of the following is not a valid attribute of a file object (fp)?

Q. How do you get the name of a file from a file object (fp)?

Q. What is the difference between r+ and w+ modes?

Q. Which of the following is not a valid mode to open a file?

Q. Which of the following is modes of both writing and reading in binary format in file.?

Q. Is it possible to create a text file in python?

Q. Which function is used to close a file in python?

Q. Which function is used to write a list of string in a file

Q. Which function is used to write all the characters?

Q. Which function is used to read single line from file?

Q. Which function is used to read all the characters?