71. What will be the output of the following Python code?
import re
s = "A new day"
m = re.match(r'(.*)(.*?)', s)
print(m.group(2))
print(m.group(0))
import re
s = "A new day"
m = re.match(r'(.*)(.*?)', s)
print(m.group(2))
print(m.group(0))
72. What will be the output of the following Python code?
s = 'welcome home'
m = re.match(r'(.*)(.*?)', s)
print(m.group())
s = 'welcome home'
m = re.match(r'(.*)(.*?)', s)
print(m.group())
73. What is the output of the following code:
import re
pattern = re.compile(r'(d+)s(w+)')
result = pattern.findall('There are 5 apples and 3 oranges.')
print(result)
import re
pattern = re.compile(r'(d+)s(w+)')
result = pattern.findall('There are 5 apples and 3 oranges.')
print(result)
74. The following Python code snippet results in an error.
c=re.compile(r'(\d+)(\[A-Z]+)([a-z]+)')
c.groupindex
c=re.compile(r'(\d+)(\[A-Z]+)([a-z]+)')
c.groupindex
75. What will be the output of the following Python code?
a = re.compile('0-9')
a.findall('3 trees')
a = re.compile('0-9')
a.findall('3 trees')
76. The output of the following two Python codes are the same.
p = re.compile('hello')
r = p.match('hello everyone')
print(r.group(0))
r = re.match('hello', 'hello everyone')
print(r.group(0))
p = re.compile('hello')
r = p.match('hello everyone')
print(r.group(0))
r = re.match('hello', 'hello everyone')
print(r.group(0))
77. Which of the following functions creates a Python object?
78. Which of the following special characters represents a comment (that is, the contents of the parenthesis are simply ignores)?
79. What will be the output of the following Python code?
sentence = 'we are humans'
matched = re.match(r'(.*) (.*?) (.*)', sentence)
print(matched.groups())
sentence = 'we are humans'
matched = re.match(r'(.*) (.*?) (.*)', sentence)
print(matched.groups())