Back to Library
QID: #62967
Solution for QID #62967: Write Python program to check that a string contains only a- | StudyHelpMe
Write Python program to check that a string contains only a-z, A-Z and 0-9 characters, return True when it is valid.
Think carefully about when you want to return True or False based on your regular expression.
Use the code skeleton below. Populate '_______________' with an appropriate regular expression. (You can reverse the True and False as would be proper for your regex.):
import re
def is_allowed_specific_char(string):
if re.search( '_______________',string):
return True
else:
return False
print(is_allowed_specific_char("ABCDEFabcdef123450"))
print(is_allowed_specific_char("*&%@#!}{"))
print(is_allowed_specific_char("hello!"))
ZERO AI
Human Written
Human Written
PHD EXPERTS
Verified
Verified
TURNITIN
Clean Report
Clean Report
FAST DELIVERY
Instant/Hourly
Instant/Hourly