Question: Having issue in Regular Expression in Python not getting desire result, some of expected result are passed but some of expected result are failing not
Having issue in Regular Expression in Python not getting desire result, some of expected result are passed but some of expected result are failing not sure where we went wrong. Please advise us
import os import re # Enter your code here def function(a): match =("[^aeiou]*[aeiou]*$",a) if match: return match else: return match if __name__ == "__main__": a = input() b = function(a) if b: print(True) else: print(False)
Input (stdin) Africa Your Output (stdout) True Expected Output True
Input (stdin) Brazil Your Output (stdout) True Expected Output False
Here string will have 2 word both should start with e
def function(a): m= a return m
Input (stdin) east eagle Your Output (stdout) True Expected Output True
Input (stdin) eight packs Your Output (stdout) True Expected Output False
String should start with letter
def function(a): result= a return result
Input (stdin) India won World Cup in the year 1983 Your Output (stdout) True Expected Output True
Input (stdin) 22 players will be involved in a cricket match Your Output (stdout) True Expected Output False
def main(x): pattern=x names=x values=x dicts=x return dicts
Input (stdin) Dhoni scored 100 runs and Kohli scored 150 runs.Rohit scored 50 runs and Dhawan scored 250 runs. Your Output (stdout) Dhoni scored 100 runs and Kohli scored 150 runs.Rohit scored 50 runs and Dhawan scored 250 runs. Expected Output {'Dhoni': '100', 'Kohli': '150', 'Rohit': '50', 'Dhawan': '250'}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
