0
Python practice starts with ends with
Hi, I‘m struggling to find the right regex pattern to do the task: starts with m, ends with e, len 4. Following code works but I’m unable to add the ends with part. I tried adding e$ in some variants to the re.match expression with no success. import re word = input() #your code goes here if len(word) == 4 and re.match(r"^m", word): print ("Match") else: print ("No match")
2 odpowiedzi
+ 3
This should work fine => "^m.{2}equot;
+ 1
thank you. it works and the len... isn‘t nessecary anymore too.