Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+17 votes

In part f, why do we still count when the word length > 10?

asked in CSC211_Winter2018 by (1 point)

2 Answers

+8 votes

Not exactly sure what you mean by, "count". If you mean go through the loop, then the answer is that if does not go through the loop when word length > 10.

answered by (1 point)

I did. So the word "bbbbabbbb", the word length is 9 and the count is up to 4. I thought it should end there but i keep continue "bbbbbabbbbb", which the word length is 11 and it still count up to 5.


I think you are forgetting about the first time it goes through the loop when the word is "a"


When the word length is 9, it has gone through the loop 5 times.


But if count "a" = 1, then should it loop 6 times because it still count the last word "bbbbbabbbbb"?


No, it will not go through the loop when the word is, "bbbbbabbbbb"?


But as I review the slide from the class, the example number <50, the output is number 80. So it still goes through do while loop ?


Yes, the OUTPUT is 80, just like in the program the WORD would be, "bbbbbabbbbb" but the number of time that it goes through the loop is 5 in Practice.It. As soon as the while loop is false, the loop stops.

+7 votes

oh I got it. Thank you.

answered by (1 point)