We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Alternative Matching
Alternative Matching
Sort by
recency
|
158 Discussions
|
Please Login in order to post a comment
Regex_Pattern = r'^(Mrs|Mr|Ms|Dr|Er)[\.][a-zA-Z]+$'
why this regex not worked for testcase 1 (Mr#DOSHI) is matched correctly how ?
**explain anyone **
import re import webbrowser
def add(x, y): return x + y
def subtract(x, y): return x - y
def multiply(x, y): return x * y
def divide(x, y): if y != 0: return x / y else: return "Error: Division by zero"
def calculator(): print("Simple Calculator") print("Select operation:") print("1. Add") print("2. Subtract") print("3. Multiply") print("4. Divide")
if name == "main": calculator()
The test cases for Python need enhancement to avoid the use of the regular expression pattern below:
Currently, this pattern incorrectly matches strings such as "E.a", yet all test cases still pass. This issue needs to be addressed.
java public static void main(String[] args) {