""" Write a function validCard that has one parameter - string. The function returns True if the string represents valid American Express credit card number and False otherwise. Valid American Express Credit Card number has the following format: XXXX-XXXXXX-XXXXX. The length of the card number is 17 and each session consists of digits only. Write main that first reads the number of users to check. Then the program reads the card number for each user. Card numbers are stored in one dimensional list of strings. The program creates two additional one dimensional lists: first list will include all valid card numbers and second list will include all non valid card numbers. Program prints each list and prints the number of valid cards and the number of non-valid cards. """ def make_list_string(size): list=[] for i in range(size): str=input("enter string ") list.append(str) return list def validCard(str): cond1=(len(str)==17) if(cond1==True): str1=str[0:4] str2=str[5:11] str3=str[12:] print("parts of the string for testing purposes",str1, str2, str3) cond2=str1.isdigit() cond3=str2.isdigit() cond4=str3.isdigit() cond5=((str[4]=='-') and (str[11]=='-')) if(cond2 and cond3 and cond4 and cond5): return True else: return False else: return False def main(): list=make_list_string(5) valid=[] nonvalid=[] for str in list: if(validCard(str)): valid.append(str) else: nonvalid.append(str) print("valid",valid) print("nonvalid",nonvalid) main()