We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89bfae2 commit c634280Copy full SHA for c634280
RegEx/README.md
@@ -103,3 +103,25 @@ Answer: b
103
Explanation: It will look for the pattern at any position in the string.
104
```
105
* * *
106
+
107
+## Question_6: What is the output of the following? ##
108
+Question:
109
+```python
110
+sentence = 'horses are fast'
111
+regex = re.compile('(?P<animal>\w+) (?P<verb>\w+) (?P<adjective>\w+)')
112
+matched = re.search(regex, sentence)
113
+print(matched.groupdict())
114
+```
115
+s
116
117
+a) {‘animal’: ‘horses’, ‘verb’: ‘are’, ‘adjective’: ‘fast’}
118
+b) (‘horses’, ‘are’, ‘fast’)
119
+c) ‘horses are fast’
120
+d) ‘are’
121
122
+Answer:
123
124
+Answer: a
125
+Explanation: This function returns a dictionary that contains all the matches.
126
127
+* * *
0 commit comments