Ask your own question, for FREE!
Computer Science
kekeman:

Suppose you are writing a program that counts the number of alphanumeric characters in every sentence in a document. Would you use a for loop or a while loop to process each sentence, and why? A for loop because the program must establish maximum sentence length. A for loop to control the number of characters the program will process in each sentence. A while loop because the program cannot predict the length of a sentence. A while loop to specify the list of alphanumeric characters the program will recognize.

Vocaloid:

When you use a for loop, you generally need to know how many times you need to iterate through the loop In this case, we don’t know ahead of time how long the sentences, so we don’t know how many times the loop needs to iterate. So in this case, a while loop would be better.

kekeman:

Hmmm so C.) sounds like the better option " A while loop because the program cannot predict the length of a sentence."

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
speakinofplaq: How do you say , " Can I borrow a pencil ? " In Spanish ?
5 hours ago 2 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!