moredata "yeswhile moredata[ =" " eval(input("enter number >")sum sum count count moredata input("do you have more numbers (yes or no)"print("\nthe average of the numbers is"sum countmain(notice this program uses string indexing (moredata[ ]to look just at the first letter of the user' input this allows for varied responses such as "yes," ,"yeah,etc all that matters is that the first letter is " here is sample output from this programenter number > do you have more numbers (yes or no)yes enter number > do you have more numbers (yes or no) enter number > do you have more numbers (yes or no) enter number > do you have more numbers (yes or no) enter number > do you have more numbers (yes or no)nope the average of the numbers is in this versionthe user doesn' have to count the data valuesbut the interface is still not good the user will almost certainly be annoyed by the constant prodding for more data the interactive loop has many good applicationsthis is not one of them sentinel loops better solution to the number averaging problem is to employ pattern commonly known as sentinel loop sentinel loop continues to process data until reaching special value that signals the end the special value is called the sentinel any value may be chosen for the sentinel the only restriction is that it be distinguishable from actual data values the sentinel is not processed as part of the data here is general pattern for designing sentinel loopsget the first data item while item is not the sentinel process the item get the next data item