0
Python Core-Regular Expressions_Checking if input word's first 2 letters are "gl"....Help!
This is the code I type in...I am aware it just looks for "gl" in the input word....but if in this line if re.match(pattern,word): I type in (word[0]+word[1]) instead of word, it doesnt work either....Any one can please help me? import re #your code goes here pattern=r"gl" word =input() if re.match(pattern,word): print("Match") else: print("No Match")
2 ответов
+ 5
import re
#your code goes here
pattern=r"^gl.*"
word =input()
if re.match(pattern,word):
print("Match")
else:
print("No Match")
+ 1
thank you Oma