python - Write a program to allow the user to enter a number of 5-character product codes, in the format LLNNN (L=letter, N=number) -
write program allow user enter number of 5-character product codes, in format llnnn (l=letter, n=number).
count , print total number of product codes starting “ab” , total number of product codes ending in “00”.
devise set of test data test program , show evidence of testing.
here have far prints 0 @ end.
print( """ welcome product code sorter. plese enter stop signal have finished. please enter in format llnnn """) ab = 0 oo = 0 product = input("please enter product code ") while (product != "stop"): product = input("please enter product code") def count_letters(ab): ab in word: if product == "ab": ab += 1 return product 00 in word: if product =="00": oo += 1 return product print(ab) print(oo)
Comments
Post a Comment