前提
一个函数match1,该函数带有一个字符串参数(test_string),如果test_string完全由偶数个零(0),一个或多个1(1)组成,则返回True,否则返回False。
def match1(test_string):
c=0;
k=0;
for i in test_string:
if (i=="1"):
c+=1
else:
k+=1
if (k%2==0)and(c>=1):
print("True")
else:
print("False")
print("\nEnter the test_string : ")
test_string=input();
match1(test_string)