Question: Write a function palindrome _ re ( n ) that takes a number n and returns a regular expression that matches strings that are palindromes
Write a functionpalindromerenthat takes a numbernand returns a regular expression that matches strings that are palindromes of length n Your regular expression can use whatever capturing groups you likewe'll only be checking whether or not it matches, not what it captures.
r palindromere
boolrefullmatchr 'abcba'
True
boolrefullmatchr 'abcbd'
False
boolrefullmatchr 'eeeee'
True
boolrefullmatchr 'racecar'
False
boolrefullmatchr##
True create a function such that it checks the first character of string is same as the last second character as second last, third as third last and so on to check if its palindrome
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
